|
What is line 197 of afxwin2.inl asserting?
"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
|
|
|
|
|
I'm guessing you're calling SetTimer() before your window's HWND is created.
Where do you call SetTimer() from?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Dear Mark,
I call SetTimer from a function a function defined by me (user defined). The Window is created before calling the SetTimer().
Please advice.
|
|
|
|
|
bhanu_8509 wrote: I got debug assertion error in afxwin2.inl line no. 197
There's no guarantee that line 197 of "afxwin2.inl" is the same in two different versions of MFC. Always look at the assert, as in general there'll be a comment near the assertion that explains what's going wrong. If that fails to help post some of the code around the actual assert.
Steve
|
|
|
|
|
Dear friends,
> mfc80d.dll!CWnd::SetTimer(unsigned int nIDEvent=1, unsigned int nElapse=100, void (HWND__ *, unsigned int, unsigned int, unsigned long)* lpfnTimer=0x00000000) Line 197 + 0x2b bytes C++
The above is the info when I access the SetTimer function. The info is obtained from STACK. The line in afxwin2.inl is below:
{ ASSERT(::IsWindow(m_hWnd)); return ::SetTimer(m_hWnd, nIDEvent, nElapse,
lpfnTimer); }
Please advice and help me.
|
|
|
|
|
Looks like Mark was on the right path when he said, "I'm guessing you're calling SetTimer() before your window's HWND is created."
The ASSERT fires because IsWindow returned FALSE . This indicates that the HWND isn't valid. What is the value of the m_hWnd member?
Steve
|
|
|
|
|
Dear Steve and Mark,
For the m_hWnd ,the value is NULL. When I inspect the variable, I have the following value.
CXX0030: Error: expression cannot be evaluated
Please advice.
|
|
|
|
|
Looks like you haven't created the window yet (as Mark said). See the CWnd::Create[^] function and its friends.
Steve
|
|
|
|
|
Dear Steve,
I am creating a Window from my own class like below. The window is created properly. I can see the window also. Please advice.
m_pWnd1 = new CMywnd1;
if(!m_pWnd1->CreateEx(NULL,
AfxRegisterWndClass(NULL,0,
(HBRUSH)::GetStockObject(BLACK_BRUSH),0),
LPCTSTR(""), WS_POPUP | WS_VISIBLE | WS_SYSMENU ,
115,51,600,405,my_hWnd1,NULL,NULL))
return;
my_hWnd1 = m_pWnd1->GetSafeHwnd();
|
|
|
|
|
Dear Steve and Mark,
I had overcome the issue in a tricky way (dont know the exact problem). I called the SetTimer in OnInitDialog() and it seems to be working fine. Actually, I am creating a popup dialog after creating the main dialog in my program. But I tried giving the SetTimer() before creating the popup window but the same error presists. When I give in OnInitDialog() I dont have any assertion error.
Please advice. Anyhow, I solve the problem without knowing what is actually happening.
Thank you very much for your kind responses.
Many thanks.
|
|
|
|
|
bhanu_8509 wrote: When I give in OnInitDialog() I dont have any assertion error.
That's because that's the first place you can use a CWnd object where its
HWND is valid
That's a perfectly acceptable place to call SetTimer(). Any time before the
WM_INITDIALOG message is received, the HWND isn't set yet, causing the error.
Any time AFTER your CreateEx() call should be fine too, as long as the create
succeeded. WM_INITDIALOG is just one of the messages sent DURING creation.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey I was wondering what the best way to communicate my high scores to my website. I have a highscores.bin file and I need a way to open a socket on port 80 and upload/grab it from the server. Is this even possible and if not whats an easier way.
|
|
|
|
|
Look for a HTTP client or FTP client class. A FTP client is probably easier... with an HTTP client you need to install a CGI/script that allows uploading files to the web server.
Hope it helps!
/M
|
|
|
|
|
Hi,
I am creating a binary file in my application and i need to copy this binary file to another location using the CFileDialog class. how do i do that.
|
|
|
|
|
Get the path where you have to copy the file from CFileDialog and use CopyFile(/*params*/) or see SHFileOperation
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi there people.
I'm trying to redirect the stderr of a process let's say cmd.exe to a raw socket.
I have completed this task by setting the sterr parameter = my socket handle.
I was looking for a function that can take this handle and encrypt the stderr before
sending it to the socket. I could use CreateFile for exampe in order to cache the data
to a file and encrypt it here but it's a bad ugly solution.
In fact I was looking something like CreateBuffer or CreateByte array or MemoryStream of C#.
In other words an intermediate function with a HANDLE input that can return the bytes or something
in order to encrypt them.
Thanx
|
|
|
|
|
hi
how can i read entries from a specified section in the registry while i don't know the entries names? i need to read them all, whatever they might be.
i know that a way is to put a key in the section with a specified name valued with the number of entries and specify retrievable names for the others.
but is there any way other than this? i like to enumerate all of them without having to know the names exactly.
i hope i could describe my question
thx
|
|
|
|
|
Does RegEnumKey [^] fit your needs?
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
[My articles]
|
|
|
|
|
I began in 1984 with a ZX Spectrum, learning BASIC and Z80 Assembly, then I sleept for a while before returning to programming.
It is very unfair of you to have sleepted.
My troll needs to be attended here[^]
|
|
|
|
|
Rajesh R Subramanian wrote: I began in 1984 with a ZX Spectrum, learning BASIC and Z80 Assembly, then I sleept for a while before returning to programming.
Thank you for pointing out.
Rajesh R Subramanian wrote: My troll needs to be attended here[^]
Fixed. (Being so recent, in this morning patrol I didn't catch 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
[My articles]
|
|
|
|
|
Some lardass downvoted this[^] too.
|
|
|
|
|
[military tone]
Fixed Sir!
[/military tone]
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
[My articles]
|
|
|
|
|
Thanks pal. But why is your profile standing not corrected? Still shows "Sleept".
May be I am receiving a copy from some local server's cache.
|
|
|
|
|
Rajesh R Subramanian wrote: May be I am receiving a copy from some local server's cache.
0r maybe someone's is just too lazy...
[again militare tone]
Sir, I'm going to fix it, Sir!
[/again militare tone]
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
[My articles]
|
|
|
|
|
And see here[^] if does nay help.
|
|
|
|