Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 KB | None | 0 0
  1. #include <Windows.h>
  2.  
  3. HDDEDATA CALLBACK DdeCallback(UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
  4. {
  5.     return 0;
  6. }
  7.  
  8. int main(int argc, char *argv[])
  9. {
  10.     DWORD idInst = 0;
  11.  
  12.     UINT result = DdeInitialize(&idInst, &DdeCallback, APPCLASS_STANDARD | APPCMD_CLIENTONLY, 0);
  13.  
  14.     if (result != DMLERR_NO_ERROR)
  15.         return result;
  16.  
  17.     HSZ hszService = DdeCreateStringHandle(idInst, L"AcroViewR11", CP_ACP);
  18.     HSZ hszTopic = DdeCreateStringHandle(idInst, L"control", CP_ACP);
  19.  
  20.     HCONV hConv = DdeConnect(idInst, hszService, hszTopic, NULL); // blocks for ~30sec when Hey Cortana is enabled
  21.  
  22.     if (hConv != NULL)
  23.         DdeDisconnect(hConv);
  24.  
  25.     DdeFreeStringHandle(idInst, hszService);
  26.     DdeFreeStringHandle(idInst, hszTopic);
  27.     DdeUninitialize(idInst);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement