|
Where in CMainFrm() does the program call CreateThread()?
Kuphryn
|
|
|
|
|
The function is an afx message handler from a menu.
void CMainFrame::OnFileOpenstream (void) is the prototype.
"Programming today is a race between software engineers striving to build bigger and
better idiot-proff programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
RichardS wrote:
contains 4 pointer to the CMainFrame Object
Do not pass MFC objects across threads. This is a well known issue and is documented on MSDN.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I have found that if I put a :Sleep (10) after creating tehe thread it runs fine. Do you know where the MSDN documentation for this is?
"Programming today is a race between software engineers striving to build bigger and
better idiot-proff programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
RichardS wrote:
I have found that if I put a :Sleep (10) after creating tehe thread it runs fine. Do you know where the MSDN documentation for this is?
There should be no reason for that to change the behavior of your thread unless there is some problem in your code. No it is not documented that I know of since I don't believe it is any type of feature.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Why are you not using AfxBeginThread() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I am used to writing non-MFC applications/libraries so CreateThread was the only alternative that I knew about.
"Programming today is a race between software engineers striving to build bigger and
better idiot-proff programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Hi,
In my code i use a dialog which contains a propertysheet with multiple propertypages.
All propertypages contain comboboxes and editboxes for the user to fill in.
I would like to have all the propertypages validated [B]as soon as the Ok button
of the dialog is pressed[/B]. This means probably that i can not place validation code in DoDataExchange(), because this function is called everytime when a tab is switched.
The Address Book of Microsoft which can be found in 'Programs->Accessories' also uses this kind of validation. It validates the pages as soon as OK is pressed, not between switching tabs.
How can i do this?
|
|
|
|
|
Do your validating in OnOK()
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
How, by the WinApi facilities, knowing handler of window, attach other window to him, for example button.
//======================================
HWND hWnd1 = FindWindow(NULL, "TestWnd");
HWND hWnd2 = CreateWindow("button", "TestButton", WS_CHILD, 0,0,100,100, hWnd1, NULL, NULL, NULL);
ShowWindow(hWnd2, SW_SHOW);
UpdateWindow(hWnd2);
//======================================
Show me please, where I wrong.
|
|
|
|
|
As far as I know, you can not make windows in another process other than your own.
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
In Report style fot a list ctrl .
When I insert items , every new item enters at the top , so if I enter 1,2,3,4 in list control one by one it will look like
4
3
2
1
although i choose the Sorting to None.
But I want that every new item should be entered at bottom and i also dont want sorting , sequence in my case is very important.
So how to insert every new item at the last of list ctrl. to have such kind of result
1
2
3
4
where 1 entered first , 2 secondly and so on.
Unmanaged in a .NET world
|
|
|
|
|
int InsertItem( int nItem, LPCTSTR lpszItem );
nItem is the index in the ListCtrl where your item gets if you insert, it sound like you have hardcoded it to 0.
to enter 1, 2, 3, 4 do
InsertItem(0, "1");
InsertItem(1, "2");
InsertItem(2, "3");
InsertItem(3, "4");
Arjan
|
|
|
|
|
if I'm not mistaken AddString or something should add items at the bottom off the list. InsertItem will insert the item at a given position.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
V. wrote:
if I'm not mistaken AddString...
... is a CListBox() method.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi,
I use SetSystemCursor to change the normal mouse cursor to something else, and 2 seconds later change it back to it's original. I can change the cursor the first time. but the second change does not happen until the first change is called once again. Please advise.
thanks a million , see below.
ps. CopyCursor doesn't seem to work.
this is inside a function that is called every 4 seconds:
at the end of 1 second change mouse cursor from normal to appstarting
hCurCopy = LoadCursor(NULL, IDC_APPSTARTING);<br />
SetSystemCursor(hCurCopy,OCR_NORMAL);
later in the code
at the end of 3 seconds change cursor from appstaring to normal
hCurNorm = LoadCursor(NULL,IDC_ARROW);<br />
SetSystemCursor(hCurNorm,OCR_APPSTARTING)
|
|
|
|
|
Use following codes
//... Set Your Cursor
SetCapture();
SetCursor(AfxGetApp()->LoadCursor(IDC_APPSTARTING));
//... Restore to old
ReleaseCapture();
SetCursor(AfxGetApp()->LoadCursor(IDC_ARROW));
|
|
|
|
|
I've just had an error reported by a customer saying that my VC++6 Program will not install on Windows NT 4. They say there is an 'error message concerning 6883 in the MFC42.DLL'.
Anyone seen this before? What can I do about it? We haven't got an NT machine to try it on so I am a bit stumped at the moment!
Any ideas?
Ali
|
|
|
|
|
The DLL on your customers machine is out of date, it can't export the function with ordinal 6883. Try supplying your customer with a newer DLL or beter yet, link your program statically so it won't need the customers DLL!
Arjan
|
|
|
|
|
Thanks, for the help - sounds like one quuick fix and one more permanent fix. I've never considered linking any differently - I will look into it.
By the way, what are the pro's & con's of linking statically & dynamically?
Any problems I should look out for?
Thanks Again
Ali
|
|
|
|
|
General rule of thumb - always link statically!
You have found the "con" of linking dynamically - if the libraries (MFC42.DLL and MSVCRT.DLL) are out of date on your customer system, then you'll have to redistribute them - and that is a royal pain.
The "con" of linking statically is that your executable will be a little bigger. It is also a little trickier if you call another MFC DLL and try to share memory/data between the two.
An expert is somebody who learns more and more about less and less, until he knows absolutely everything about nothing.
|
|
|
|
|
Alison Pentland wrote:
By the way, what are the pro's & con's of linking statically & dynamically?
Any problems I should look out for?
If you statically link code, it may require upgrades in other DLLs that could never be statically linked.
Also, if you have a DLL that is statically linked with MFC, and it is being used by an EXE that is dynamically linked with MFC, there will be troubles. In other words, if the EXE has already loaded MFC42.DLL, you will have
problems because your DLL is trying to load a second copy, and the two will
become confused. Alternatively, you will end up with whatever copy the
EXE has loaded.
See if this thread helps any.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have tried to use this article:
"All you ever wanted to know about the Clipboard..."
http://www.codeproject.com/clipboard/clipboard_faq.asp?df=100&forumid=137&select=881708#xx504274xx
and the infromation that it provides to retrieve a bitmap from the clipboard, and it doesn't seem to be working. When I run the debugger it seem that this call is the one that is not working:
HBITMAP handle = (HBITMAP)GetClipboardData(CF_BITMAP);
The debugger has the following listed for handle:
CXX0030: Error: Expression can not be evaluated.
Why is this? What has gone wrong? If anything, cause I may just not understand it.
Micheal
|
|
|
|
|
I have a strange problem with CTreeCtrl::DeleteAllItems under VS2003: it seems impossible to insert a new tree item after having called this function.
Let's try a simple example:
- Create a new MFC dialog application,
- Add a tree control in the dialog,
- Associate a CTreeCtrl variable with it,
- in the OnInitDialog, add the code:
c_Tree.InsertItem(_T("Item before"));<br />
c_Tree.DeleteAllItems();<br />
c_Tree.InsertItem(_T("Item after"));
When executing the prg, the control remains empty. However, if I comment the call to DeleteAllItems, I see two items as expected.
Has anybody already experimented this ?
|
|
|
|
|
Just a quess but try adding a UpdateData(FALSE); after the last InsertItem
Arjan
|
|
|
|