|
I can't help you directly with C++ - I use C, a real man's programming language! But this code should work, anyway.
Here is an extract from my main window procedure, where I handle the messages:
LONG WINAPI MainWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_KEYDOWN:
switch(wParam)
{
case VK_F1:
WinHelp(hWndPrimary, ".\\helpFileName.hlp", HELP_FINDER, 0);
break;
|
|
|
|
|
what is hwndprimary in this code?
|
|
|
|
|
It would have been a lot quicker for you if you looked up WinHelp in the MSDN help, to see what parameters it takes. This way you had to wait 12 hours for an answer.
Anyway, my application opens multiple windows, and hWndPrimary is the Handle to the Primary (i.e. main) Window.
|
|
|
|
|
|
the link u gave is good. i have used the same procedure to create help files in VisualBasic application. can i use the same method in vc++ too? i want to display the help when f1 is pressed.whats the code to do this?
Thank You
|
|
|
|
|
Please refer to the next page in the link.
Maxwell Chen
|
|
|
|
|
The help given in MSDN or Microsoft website isn't clear.could you please tell me the procedure to create the word document and also the code to add it to the application.
Thank You
|
|
|
|
|
Please listen to my idea.
I created a client/server model in UDP. Now its a one-way thing. The server keeps "recvfrom" and the client keeps "sendto". its ok. but now I wanna make it Two-way.
In the server,shall I create another sock in a separate thread? that makes the "sendto" part.
And similarly , create another sock in client to make the "recvfrom" ??
Server ````````````````````` Client
<br />
1.sender -------------------> 1. Receiver.<br />
2.Receiver <------------------ 2. Sender.<br />
Is this a good design? or should I make it like...
<br />
1.Sender/Receiver <------------------> 1.Receiver/Sender<br />
If you say , the latter is the right method, also tell me how'd I do that?
|
|
|
|
|
Helo guys! I am working on a project where I have to get addresses from user interation and then get ahead wih my job. And the addresses I retrive are of the form:
d:\Somefolder\Somfile.something
And _unlink does not work on adresses of these kinds. I have to change it to something that looks like this:
D:\\Somefolder\\Somefile.something
Only then everything works fine.
Can somebody comment.
By the way I am using VS 2002
Abhishek
|
|
|
|
|
That's because the character '\' is an escape character. To specify you want the '\' character, you need to duplicate it.
|
|
|
|
|
I've created a hook using SetWindowsHookEx() which through the use of WH_SHELL has been able to monitor the creation of all windows.
I've also been trying to use this hook to monitor destruction of windows through the use of HSHELL_WINDOWDESTROYED. The documentation claims that the hook will be called prior to the window being destroyed. It also claims the WPARAM parameter will contain an HWND to the window about to be destroyed. My problem is that the WPARAM is NULL every time my hook gets called and in no way the HWND to the window. Is there something i'm missing?
A side note: HSHELL_WINDOWCREATED and HSHELL_WINDOWDESTROYED is never called by certain windows such as that of a console application however HSHELL_WINDOWACTIVATED is called by the console programs. I've been using this to 'detect' the creation of the console windows. The window is automatically activated when it launches. I still have no method for detecting console application termination.
|
|
|
|
|
plz tell me how to find the username of a system,i m working in console application using winsock header file.
|
|
|
|
|
|
Hi!
what is the smallest pointer address?
I think a pointer is never 1,2 (or 3)
to example :
void DrawDFText( LPSTR a) <br />
<br />
UINT i = (UINT) a;<br />
<br />
if ( i > 2 ) {<br />
TCHAR szBuf[180];<br />
wsprintf(szBuf, "address:%d ", a ); <br />
OutputDebugString( szBuf );<br />
return;<br />
};<br />
if ( i == 1 ) dothat1;<br />
if ( i == 2 ) dothat2;
it's right?
Regards!
Frigyes
|
|
|
|
|
Hi
Theoretically there is no smallest address a pointer can point to. In windows and c++ there is. But there is no need to know that value since you should never test against it. If you get a pointer like "LPSTR pStr" you should only check that its "!= NULL". Any thing else and you should assume that it’s a valid pointer. Its to job of the person giving you the pointer to be sure he gives you a valid one.
Also since this is c++ you really shouldnt use char arrays. Either use STL std::string or MFC CString when you need strings.
If you really want to know about how windows handles the memory and how pointers in it work. I can recomend the following book "Programming Applications for Microsoft Windows" by Jeffrey Richter[^]
Magnus
|
|
|
|
|
Hi Magnus!
many thanks for your answer!
> ... there is no need to know that value since you should never test it
but I must test it,
if I call my Drawtext procedure with 1 should start BeginPaint,
if I call with 2 should start EndPaint,
if NULL it's a error,
otherwise should be draw the text from the pointer,
(the procedure is a DLL procedure, and I can't use too many parameters)
can be the address from one pointer 1 or 2 ?
void __declspec(dllexport) DrawDFText( LPSTR a)<br />
{ ... }<br />
<br />
<br />
and call like:<br />
<br />
DrawDFText(1);<br />
<br />
DrawDFText("line1");<br />
DrawDFText("line2");<br />
...<br />
DrawDFText(2);
Regards!
Frigyes
|
|
|
|
|
Frigyes Nagy wrote: DrawDFText(1);
DrawDFText("line1");
DrawDFText("line2");
...
DrawDFText(2)
This is SO bad !!!
Why don't you create a function BeginPaint, EndPaint to do that explicitly ?
Frigyes Nagy wrote: the procedure is a DLL procedure, and I can't use too many parameter
Huh ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi!
I know, this is not really pretty, but it's works, and I never find any pointer address less then 1000.
(this is one DLL for my DATAFLEX program, I don't like to export 3 procs, if I can make the same work with a ugly one)
Regards
and sorry my english
Frigyes
|
|
|
|
|
Frigyes Nagy wrote: I never find any pointer address less then 1000.
There is a trick (a MACRO) found in the library to count the memory offset of the data member from the address of the struct which owns the data member.
It takes a pointer with the address = 0.
Maxwell Chen
|
|
|
|
|
Frigyes Nagy wrote: I never find any pointer address less then 1000.
Another instance to see the address less than 1000 is something like this way:
class MyTool<br />
{<br />
public:<br />
WORD MergeValue(BYTE hi, BYTE lo) {<br />
WORD wT = hi;<br />
return (wT << 8) | lo;<br />
}<br />
};<br><br />
MyTool* pTool = 0;<br />
WORD v = pTool->MergeValue(0x43, 0x21);<br />
Maxwell Chen
|
|
|
|
|
Hi!
thanks!
but this is to complex for me,
I speak from pointers to a string, allocated with new,
I can't imagine that they have address LT 1000, but ...
Regards
|
|
|
|
|
Frigyes Nagy wrote: wsprintf(szBuf, "address:%d ", a );
A pointer should be something like
UINT* pNum = &a;
And, to observe the address of the pointer, you should do this way:
sprintf(szBuf, "address: 0x%p \n", pNum);
Maxwell Chen
|
|
|
|
|
Hi!
thanks!
but LPSTR is also a pointer to a null-terminated string
This type is declared in Winnt.h as follows:
typedef CHAR *LPSTR;
void DrawDFText( LPSTR a) <br />
{<br />
<br />
sprintf(szBuf, "address: %d ", a); <br />
<br />
};
works for me...
Regards
Frigyes
|
|
|
|
|
Frigyes Nagy wrote: but LPSTR is also a pointer to a null-terminated string
I did not notice the first line about the function prototype...
Maxwell Chen
|
|
|
|
|
hi,
Is there any limitation on maximum number of threads a win32 process can spawn..??
Thanks,
|
|
|
|