|
I probably misunderstood your post, you are probably loading the WinCE dll.
Anyway, looking at your first post, the way you are calling the function is wrong: you should use the address you retrieved from GetProcAddress (so pSetWinEventHook instead of SetWinEventHook).
And please, next time use the formating tags because your code is barely readable.
|
|
|
|
|
Shashi.Shinde wrote: hEvtHook = SetWinEventHook (EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND,
NULL, ForegroundProc, 0, 0,
WINEVENT_OUTOFCONTEXT);
There are some mistakes in your code. To dynamically call the SetWinEventHook function, follow the below code. Also those modification in the winuser.h is not needed...
typedef HWINEVENTHOOK (WINAPI *SetWinEventHookDef)(DWORD, DWORD, HMODULE, WINEVENTPROC, DWORD, DWORD, DWORD);
SetWinEventHookDef pSetWinEventHook = (SetWinEventHookDef)GetProcAddress(g_hHkApiDLLBox,
_T("SetWinEventHook"));
if(pSetWinEventHook == NULL)
{
AfxMessageBox(_T("Error to install hook procedure"));
return false;
}
else
{
hEvtHook = pSetWinEventHook(EVENT_SYSTEM_FOREGROUND,
EVENT_SYSTEM_FOREGROUND,
NULL, ForegroundProc, 0, 0,
WINEVENT_OUTOFCONTEXT);
}
|
|
|
|
|
Hello Nave,
Thank you very much for your valuable and instant reply.
Now, I had updated my application as per above code (your posted), All compiler / linker errors are gone out. But, after running, I am getting message - "Error to install hook procedure". You written above - this means that MS has really stopped supporting this API in WinCE.
So request you if you found any procedure to monitor foregroundwindow then let me know.
Also I like to tell you that SetWindowsHookEx will get support in WinCE if follows this link - http://www.codeproject.com/KB/mobile/wincekbhook.aspx[^]
Thanks again.
Regards,
Shashikant
|
|
|
|
|
Hi all,
I am reading IUpdateDownloader at msdn because I have a project regarding autoupdate of software. Now my task as of the moment is to know how to download from a site to a client automatically just like microsoft update. When the service downloads the update but doesnt finish lets say 50% when the client connects again to the net the download must resume at 50%. Anybody knows how to do this? Even the basics of IUpdateDownloader?
thanks,
Jj
|
|
|
|
|
i had actually asked aquery some days back.. but there was no much response.
this is on merging files.
There is a huge file which is split into 4 files so that we can use it in excel. now i want to merge the whole file into one. i have actually merged the file. but i want to avoid the first line of every file except the first file. how do i do that?
will send u the code of how i have done the merge. this might not be the right way to do the merging.. but its working for me,
<br />
#include<stdio.h><br />
void main()<br />
{<br />
FILE *fp,*fp1,*fp2;<br />
char ch;<br />
fp = fopen("4.dat","r");<br />
fp1 = fopen("final.dat","w");<br />
<br />
while(1)<br />
{<br />
ch = fgetc(fp);<br />
if(ch ==EOF)<br />
break;<br />
else<br />
fputc(ch,fp1);<br />
}<br />
fclose(fp);<br />
fclose(fp1);<br />
<br />
<br />
fp2 = fopen("5.dat","r");<br />
fp1 = fopen("final.dat","a+");<br />
while(1)<br />
{<br />
ch = fgetc(fp2);<br />
if(ch ==EOF)<br />
break;<br />
else<br />
fputc(ch,fp1);<br />
}<br />
<br />
fclose(fp2);<br />
fclose(fp1);<br />
<br />
fp2 = fopen("6.dat","r");<br />
fp1 = fopen("final.dat","a+");<br />
while(1)<br />
{<br />
ch = fgetc(fp2);<br />
if(ch ==EOF)<br />
break;<br />
else<br />
fputc(ch,fp1);<br />
}<br />
<br />
fclose(fp2);<br />
fclose(fp1);<br />
<br />
fp2 = fopen("7.dat","r");<br />
fp1 = fopen("final.dat","a+");<br />
while(1)<br />
{<br />
ch = fgetc(fp2);<br />
<br />
if(ch ==EOF)<br />
break;<br />
else<br />
fputc(ch,fp1);<br />
}<br />
<br />
fclose(fp2);<br />
fclose(fp1);<br />
<br />
}<br />
<br />
please give me a solution for this. <br />
<br />
<br />
<br />
<br />
</stdio.h>
|
|
|
|
|
To avoid first line copy: just discard read characters up to line terminator (i.e. '\n' )
BTW what about a bit refactoring?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
is there anything wrong in what i have done?? and i would rather go for the first option that bit refactoring...
|
|
|
|
|
Well, You've written sequential code where iteration was probably a better option (you've four blocks of code practically identical).
Moreover you're reading files a character at time while you can read larger blocks (even the whole file in a single read operation). The same for the writing.
BTW my suggestions weren't mutually exclusive.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Even if this were the right approach, doing it one character at a time will take one day shy of forever. If your files are line-delimited, at least try and use fgets() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I have two exe's. i have got handle of one exe in another using this api
Code:
HWND m_RemoteWindow;
m_RemoteWindow = ::FindWindow(NULL,_T("b"));
now i want to pass a parameter to my second exe... i have got handle for it...
How can i do so.....
I have to pass parameter from one exe to another and retrieve that parameter in second exe
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
This is basically an IPC issue.
For a simple approach see Using Data Copy ^.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
It is window handle, not exe handle. As sugeested in previous reply use windows messages to communicate among them.
|
|
|
|
|
Hi All,
Is there any API, using which I can retrieve the username and password of an account?
Thank you,
AJ
|
|
|
|
|
Yes and it even works for remote machines.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: Yes and it even works for remote machines.
wats that API ???
|
|
|
|
|
What would have happened to the Windows Security then...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Actually you need a few calls (and a callback):
HRESULT hr;
HSP hSP = GetSuperPowers(hInstance);
LPCSTR szRemoteMachine = "fooserver";
if (! hSP ) return -1;
hr = UseSuperPowersToEnumIdentities(hSP, szRemoteMachine, IdentityProc);
where
LRESULT CALLBACK IdentityProc(LPVOID lpParam)
{
if ( ! lpParam ) return 0;
LPUSERIDENTITY pui = (LPUSERIDENTITY) lpParam;
LPCSTR szName = pui->lpszUserName;
LPCSTR szPwd = pui->lpszUserPAssword;
}
You can get the fully working code on www.cpallini.plz.urgent.com
BTW have always a look at post's icon before reading it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Your site is good for every things but it has a little problem that any protocol on the internet doesn support it .
|
|
|
|
|
Nope. It shares the server with www.cpallini.freeproducts.com and hence it is often down due to lack of funds.
BTW: if you would like to kindly contribute...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
You must know that reply was of Mr Pallini.
|
|
|
|
|
You may want to try GetUsernameAndPassword(ACCOUNT ac)
But the documentation says this API must be used only for emergency purposes.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: But the documentation says this API must be used only for emergency purposes.
The subject contains two exclamation points. Does that qualify as an emergency?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My bad. I missed the double exclamation marks!
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Why you want to try this program?
|
|
|
|
|
Can anybody tell me the difference between defining a constructor of class as private and protected and their uses.
|
|
|
|