Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Main entry of the program.
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) {
- MSG msg;
- char mailslotName[50];
- curId = 0;
- // Set up mailslots
- serverMailSlot = mailslotConnect("serverMailSlot");
- if (serverMailSlot == INVALID_HANDLE_VALUE) {
- MessageBox(NULL, "Failed to get a handle to the mailslot!!\nHave you started the server?", "Error", 0);
- return TRUE;
- }
- sprintf_s(mailslotName, sizeof(mailslotName), "clientMailSlot%d", GetCurrentProcessId());
- clientMailSlot = mailslotCreate(mailslotName);
- mailslotConnect(mailslotName);
- // Create lists
- localList = LL_Create();
- serverList = LL_Create();
- // Start up dialogs
- dialogMain = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(dlgMain), 0, dialogMainProc);
- if (dialogMain != NULL)
- ShowWindow(dialogMain, SW_SHOW);
- dialogAdd = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(dlgAdd), 0, dialogAddProc);
- if (dialogAdd != NULL)
- ShowWindow(dialogAdd, SW_HIDE);
- while (GetMessage(&msg, NULL, 0, 0)) {
- if (!IsDialogMessage(dialogMain, &msg) && !IsDialogMessage(dialogAdd, &msg)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment