|
here is my problem:
<br />
<br />
Class test<br />
<br />
void test::showmsg<br />
{<br />
AfxMessageBox(m_msg);<br />
}<br />
<br />
function thread<br />
<br />
UINT testThread(LPVOID param)<br />
{<br />
?????? ctrl = class mainclass control ??????<br />
<br />
for (int i = 0; i < 100; i++)<br />
{<br />
ctrl->m_msg.Format("%d", i);<br />
ctrl->showmsg();<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
this is a simple example of what i want to do, the thread is gonna be a connection with a network.
|
|
|
|
|
When launching the thread, give this as parameter.
Then with a CMainDlg *ctrl = (CMainDlg*)param; (instead of the line where you put ?????)everything should be fine.
~RaGE();
|
|
|
|
|
You should pass a pointer to your class test when calling AfxBeginThread, supplying the pointer as second parameter.
in test, where starting your thread:
AfxBeginThread(testThread, (LPVOID)this)
|
|
|
|
|
How can we insert a gif file (or any image file ) in a dialog window ?
|
|
|
|
|
If it is a bmp, you have lots of possibility (Creating a CStatic, and load your bitmap in it with help of LoadBitmap() );
For gif or other, you'll have to get a specific loader.
~RaGE();
|
|
|
|
|
App runs fine when just executed. IF i put in a breakpoint and step in:
It crashes at the point where I create a map:
CImage x;
MyMap["abc"] = x;
(alternatively I did
CImage &x = MyMap["abc"]; - same effect )
The debug window says: Invalid Address specified to RtlFreeHeap
Looked it up on the web...not much help.
The assembly is pointing to an int 3 instruction
The call stack is in NTDLL.
Its in delete() in AFXMEM.cpp ( I think thats the name of the file where the call stack points to...)
Appreciate your help,
ns
|
|
|
|
|
seems that something tries to free (delete, delete[], free(), etc) a memory block which is not valid or already freed.
You might have a stack corruption, or your map class tries to free the "abc" string. There are a lot of possible causes.
Holy Sh*t! I'm speechless. (hey, that's a first) Marc Clifton, The Lounge
|
|
|
|
|
Yup. I found that I hadnt initialized a pointer in the constructor, and then was trying to delete it instantly if it exists. Of course it existed with garbage (unintialized) in it....so it was unhappy. Many thanks for the remote - hit the nail on the head debugging....
Appreciate your help,
ns
|
|
|
|
|
hi. i am working on a Game,and ive got a little problem.
my problem is in the below code :
<br />
Canalyze_b * ab= new Canalyze_b();<br />
ab->Create(IDD_AB,this);<br />
ab->SetWindowPos(&CWnd::wndTop ,140, 140, 300, 300, SWP_SHOWWINDOW);<br />
ab->ModifyStyle( WS_POPUP ,WS_CHILD,0);<br />
ab->ShowWindow(SW_SHOW); <br />
ab->analyze(NULL);<br />
<br />
Game s;<br />
s.analyze();
the s.analyze() operation will take time about 10 or 15 seconds. and i have to show the results of caculation during the operation. for example in a Simple EditBox.
for example in analyze() i have :
<br />
void Game::analyze(){<br />
<br />
while (n<100) {<br />
----> Show results on a Simple EditBox on dialog<br />
----> Calculate the next Position<br />
}<br />
}
my problem is that during the operation nothing Shown in the EditBox
and when the Operation ends only the last Result Will Shown on the Dialog !!
i think it's coz the Calculation function will takeover Showing results on the edit box and don't let it to occure. So is there any Way to Show Without any problem !
thanxxx
Regards.
-=Ehsan-de-Burge=-
|
|
|
|
|
-=Ehsan-de-Burge=- wrote:
So is there any Way to Show Without any problem !
Sure! Create your own worker thread. Then call it with AfxBeginThread(YourThread, YourParam). For easy calling functions of your dialog pass a pointer to your dialog as YourParam (think it should look like
UINT YourThread( LPVOID pParam );
...
AfxBeginThread(YourThread, (LPVOID )ab)
).
Now you can call any function on your dialog in your thread
UINT YourThread( LPVOID pParam ){
Canalyze_b * ab= (Canalyze_b *)pParam;
ab->DoAnything()
}
That's it!
|
|
|
|
|
hello
i have already submit this question.(thx again Schlaubi for your answer but i just know WM_PARENTNOTIFY works only for WM_LBUTTONDOWN and not for WM_LBUTTONUP.
i search something for IHTMLDocument2 but nothing.
So i can detect mouse butondown, but not mouse buttonup.
How can i detect all mouse click ?
|
|
|
|
|
Well, let's try something new;)
There is the possibility to establish a sink for all document events. This seems to be quiet easy when using ATL. But as you've access to MSDN for sure I'll won't go into detail. Search MSDN for DIID_HTMLDocumentEvents and you should find an appropriate example .
|
|
|
|
|
ok thx !
i try to find something about DIID_HTMLDocumentEvents on MSDN.
i hope to succeed !
|
|
|
|
|
jeremysay wrote:
i hope to succeed !
Hmmm ... seems like my good heart ever wins ...
that's an interesting site I found on MSDN:
HOWTO: Sink HTML Document Events for WebBrowser Host
Q246247
|
|
|
|
|
thx again
it seems complex but i try to understand
|
|
|
|
|
Anyone has/knows a good library for creating performance counters? The SDK way is pretty cumbersome, and I am not willing to write a WMI high-performance provider.
Hints? Links? Ideas?
Holy Sh*t! I'm speechless. (hey, that's a first) Marc Clifton, The Lounge
|
|
|
|
|
Boy are you in for some fun times! I just went through this myself and it is NOT very straightforward. I ended up borrowing some code from MSJ August 1998 and even then the integration was a huge pain. I don't have a link for you, but you can try to search for this:
Module name: PrfData.cpp
Notices: Written 1998 by Jeffrey Richter
Description: C++ template classes for Performance Object data types.
Good luck, you're gonna need it!
|
|
|
|
|
Erik Juhl wrote:
Boy are you in for some fun times
Yes, I've noticed already
Thanks for the hints.
Anyway, I've started a integration library, it might develop to a article on CodeProject. Looks promising.
Holy Sh*t! I'm speechless. (hey, that's a first) Marc Clifton, The Lounge
|
|
|
|
|
Hi,
I have an MFC app and I want to create some Controls on the Fly!
The controls are member variables of an custom control class and
will be created in the OnPaint function of this customcontrol Class.
I have to apply a ID to them when creating(by using the Create function (...,UINT nID))
How do I create such an ID dynamically?
Thanks, Ingmar
|
|
|
|
|
ingi wrote:
OnPaint
You wanted to say OnCreate() ?
AFAIK, the controls created by your control are your controls childs, and they are not 'visible' to the outside (programatically spoken, they are, of course, visible on the screen) so you can assign them arbitrary numbers.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
ingi wrote:
I have to apply a ID to them when creating(by using the Create function (...,UINT nID))
How do I create such an ID dynamically?
If you don't use the control ID (e.g. when you use HWND or CWnd* to access your childs), you dont need one, so the IDs can all be the same (meaningless) number.
Otherwise here are some IDs: 1 2 3 4 5 ....more?
|
|
|
|
|
I am adding bitmaptoolbar.I was added sucessfully in one row.I want add tools in the second row.How to write?
|
|
|
|
|
Hello
Is there any good libraries for XML out there?
Im programming in unmanaged C++ using Visual Studio 7 (the xml classes in .net is only for managed c++, or am I wrong?)
I do not use MFC.
|
|
|
|
|
Use XML DOM.
Search MSDN Library and you'll find good help!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Is that COM components? Or am I wong. I want to use libraries.
|
|
|
|