|
Hi,
I need to create in separate thread some dialog controlled by CDialog derived class. Thread will create the dialog, process user's actions on it and after closing od dialog, thread can terminate.
I tried to create thread by AfxBeginThread() - worker thread type and i created dialog and called DoModal() in controlling function. But after displaying the dialog it still acts like modal dialog, even if it is in separate thread - i can't click in main application dialog.
How to solve this ?
Thanks
rrrado
|
|
|
|
|
It is surely better to do this with UI threads: Derive from CWinThread to, say CMyThread , override OnInitInstance and display the modal dialog there. To terminate the thread, just return FALSE from OnInitInstance .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried that, but it is doing the same thing :
class CMyThread : public CWinThread
{
DECLARE_DYNCREATE(CMyThread)
public:
...
BOOL CMyThread::InitInstance()
{
CMyDialog dlg;
dlg.DoModal();
return TRUE;
}
I made button in mail application dialog, which creates my thread. It displays modal dialog but i still can't access main application dialog until i close thread's dialog
rrrado
|
|
|
|
|
Why not make your dialog modalless?
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
One of the properties of a modal dialog box is absolute focus from the parent window. For more flexibility, use a modeless dialog box another member has mentioned.
Kuphryn
|
|
|
|
|
hi
i am doing a sample project for my knowledge purpose. i am doing a text editor like ms-word. i am not using CEdit control i like to write my own class for displaying text. how can i change the font size and fontface . please guide me.
|
|
|
|
|
There is a WordPad like sample in the Visual C++ Samples. (MSDN search should find it) This should give you a good starting point.
Michael
Fat bottomed girls
You make the rockin' world go round -- Queen
|
|
|
|
|
thank you very much for your valuable information
|
|
|
|
|
Hey all,
This is a bit of a stupid question and probably has an obvious answer, but ill ask anyways.
Ive created a Win32 project in .NET that outputs as a DLL. In it ive added 2 classes and put all my code in, and now i want to call it in either C# or MC++. Problem is, i dont know how to add it at all (in C# its under project->Add reference i think, but it keeps reporting that it cannot add it bcos its not a .NET assembly). Can anybody give a quick pointer ??
Thanks in advance
Ubersnack
Where theres a will, theres another money-grabbing no-good....
|
|
|
|
|
Well if you created a Win32 dll than that obviously is not an assembly - you need to create a .Net dll (which is an assembly essentially). Or use pInvoke to call the win32 dll from C#.
|
|
|
|
|
If I compile a code that uses MFC the size goes about 36KB. If i compile almost same code tht doesnt use MFC its size goes to 56KB.
How can I reduce the size of my exe file.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
But the 36k is without the mfc dll. Trust me, in the end, a program with mfc is _much_ bigger than a plain C one
|
|
|
|
|
Hi!
I am writing a custom window control in MFC: a tab control.
CWnd
A
|
|
MyTab
class MyTab : protected CWnd {
public:
void add(const CString& title, CDialog* dlg);
...
protected:
...
private:
...
};
Everything goes well. Now I want to seperate interfaces from implementation theorically:
CWnd ITab (abstract class as interface)
A A
| /
| /
MyTab
class ITab {
public:
virtual void add(const CString& title, CDialog* dlg)=0;
};
class MyTab : public ITab, protected CWnd {
public:
virtual void add(const CString& title, CDialog* dlg);
...
protected:
...
private:
...
};
This time, the problem exist: there is no HWND attached.
Does anyone know how to solve this? Or is there an alternative design?
Any reply would be appreciated.
sovann.
Why waste time learning while ignorence is instantaneous ? [Hobbes]
|
|
|
|
|
Sovann wrote:
This time, the problem exist: there is no HWND attached.
I have not understood what it means (hwnd of what???), but I want to give you small advice: mfc classes must be first at deriving order (MSDN says that). Swap 'public ITab' and 'protected CWnd', otherwise you will have a problems
|
|
|
|
|
I've set a waitable timer (Create/SetWaitableTimer API) to 10 seconds. Since it's been
created in a window, I can't use WaitForxxxObjectxxx sync function. So I wanna use a
feature that SetWaitableTimer encapsulates, a call for completion routine.
How can I assure the call for 'PTIMERAPCROUTINE' when a the timer has elapsed??? I read the the creating thread must be 'alert' , but I don't want to use the sync API's.
HELP!
--BlackSmith--
/*The roof is on fire, we don't need no water, let the MF burn*/. BHG.
|
|
|
|
|
BlackSmith wrote:
I can't use WaitForxxxObjectxxx sync function.
But you can use the MsgWaitForMultipleObjects
My latest article:
SQL Server DO's and DONT's[^]
|
|
|
|
|
hi there,
I have a console project where i wanted to use the exit() function, but no way, the linker does not recognize it. MSDN says it is defined in <stdlib.h> which, of course, i have included in the file. Any idea ?
#include <stdlib.h>
#include <stdio.h>
void main(void)
{
exit(0);
}
(Yes, I know, my code sample is ridiculous )
Thanks
~RaGE();
|
|
|
|
|
You'll need this too:
#include <process.h>
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++!
|
|
|
|
|
Does not work either. (Actually, MSDN says process or stdlib).
~RaGE();
|
|
|
|
|
... added some libraries in the linker tab and it works.
Thxx
~RaGE();
|
|
|
|
|
This code compiled without any errors in VC6:
#include <stdio.h>
#include <process.h>
int main()
{
exit(0);
printf("dfdfghdf");
return 0;
}
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++!
|
|
|
|
|
hi!all
on windowsXP progress bar is not getting refreshed..my same code runs fine on win98.can somebody help me out.
thanks in advance.
--Shiben.
shibenOL
|
|
|
|
|
What do you mean with not getting refreshed ? Does it display anything at all ?
~RaGE();
|
|
|
|
|
Hi!Rage
Thanks for looking into the thing.
my progress bar is getting displayed well but if i change the focus to some other object and come back again to this progress bar it stops(getting refreshed i guess)otherwise on win98 the same code works very fine.
Thanks and Regards'
--Shiben..
|
|
|
|
|
I have tried to determine if a field is PK (primary) or FK (foreign key) but not much luck. One constraint: this must be done ADO/C++.
I'm almost completing my module now... a short code sample in C++ will definitely help a lot...
Basically,
pRs->Fields->Item[j]->get_Name(&bstrFieldName); //This is how I retrieve field name.
nType = pRs->Fields->Item[j]->Type; //This is how I retrieve data type.
But how can you determine if a field is PK/FK??
Help!
Reference:
http://www.codeguru.com/forum/showthread.php?s=&postid=634066#post634066
norm
|
|
|
|