|
I have a program,using a left menu of options, when the user click on the options to the left a new frame window opens up to the right.
I want the exit button to close the program. The Exit button is located in the left menu, not in the main frame.
I have used DestroyWindow(), but when I run the program and click on Exit the program crashes.
|
|
|
|
|
|
Or try the dirty way: exit(0);
|
|
|
|
|
|
I have a dll with a dialog box that gets run when the function is called. This uses MFC.
I want to spawn a new thread that the dialog box runs in.
Here's the exported function:
extern "C" __declspec(dllexport) void XducerSpecDialog(int px, int patxrx, int cred, int tfmid, void (*TimerCallBack)(), int (*callbackFunc)(int tfmid))
I thought I could just use _beginthread, but I'm not quite sure what to do becuase I'm using MFC and I have an instance of the class object that I use to call:
theApp.RunDialog
Can I just call the _beginthread(theApp.RunDialog,0,my_arguements)???
Thanks!
|
|
|
|
|
I think you need to use the MFC thread functions within MFC, AfxBeginThread(). Unless theApp.RunDialog has a function signature of a worker thread, you might want to take a different approach. Define a worker thread with a signature like UINT MyControllingFunction( LPVOID pParam ); and use that as the first parameter to AfxBeginThread. Pass theApp as a second parameter and from inside your worker thread, call RunDialog. Here's a sample from MSDN using a CMyObject instead of theApp...
UINT MyThreadProc( LPVOID pParam )
{
CMyObject* pObject = (CMyObject*)pParam;
if (pObject == NULL ||
!pObject->IsKindOf(RUNTIME_CLASS(CMyObject)))
return 1; // if pObject is not valid
// do something with 'pObject'
return 0; // thread completed successfully
}
// inside a different function in the program
.
.
.
pNewObject = new CMyObject;
AfxBeginThread(MyThreadProc, pNewObject);
.
.
.
|
|
|
|
|
Has anyone an example of using WMI in Visual C++ ?
|
|
|
|
|
hi,
see at microsoft.com
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/example_creating_a_wmi_application.asp
hope it helps
dan o
|
|
|
|
|
Thank you !
Long time ago when I asked this question, I thought I never get an answer, but I failed: Thank you, I will try that Link out. But I already looked into MSDN Help, so I think it would not help to solve my problem. May be I have to buy a good book in WMI-Programming because I need example sources to understand really how it works (its a little habit).
Thank you
Sendel
The only place for millions of bugs is the Rainforest
|
|
|
|
|
Hi everybody
Is it possible to insert into an Active X Project an other active X?
Can you tell me about this?
dvlpt
|
|
|
|
|
From my application I open up a modless dialog. And when this dialog is closed the focus is NOT returned to the application. How can I fix that..
Anyone have any tips for me ?
|
|
|
|
|
You may possibly restore the focus manually:
void CMyModelessDlg::OnDestroy()<br />
{<br />
CWnd *pParent = GetParent();<br />
CDialog::OnDestroy();<br />
pParent->SetFocus();<br />
}
Of course your modeless dialog must be a child of the window that you want to refocus. You may also try AfxGetMainWnd()->SetFocus() otherwise.
Regards,
BB
|
|
|
|
|
Hello!
I need to move a modeless dialog over a specific control from the parent window! (On the parent window resource, I draw a picture wich will be covered by the new modeless window).
The problem is that the MoveWindow function is relative to the upper-left corner of the parent window’s client area and the GetWindowRect is in screen coordinate !!!!
Can someone help me?
Thanks!
|
|
|
|
|
I found the ScreenToClient function !
|
|
|
|
|
Hi, everyone!
I find the samples on MSDN is not very clear and
the documents are not sufficient. Where can I find
I tutorial about this topic?
regards,
George
|
|
|
|
|
Does this help:
http://www.gotw.ca/publications/using_auto_ptr_effectively.htm
|
|
|
|
|
Thanks, Xander80 buddy!
George
|
|
|
|
|
Hi, everyone!
What means "smart pointer"? Where can I find some
online materials to refer?
Thanks in advance,
George
|
|
|
|
|
smart pointer is a class that wraps a pointer and overloads operator -> , to enable clients to use the smart pointer with same syntax as regular pointer. the class takes care of lifetime of the wrapped object (e.g. reference counting for COM objects, or deallocation for regular pointers).
Example:
void fn()
{
std::auto_ptr<CMyClass> pMyClass = new CMyClass();
pMyClass->SomeFunction();
}
some examples:
std::auto_ptr<> - check MSDN library
_com_ptr_t<> - wraps COM objects, VC++ compiler supported (check MSDN library)
CComPtr<> - wraps COM objects, provided by MFC (check MSDN library)
also, check Boost[^] for few other implementations
|
|
|
|
|
Thanks, Zed buddy!
George
|
|
|
|
|
Hi,
I have created a Deskband in internet Explorer and it is working fine. My Deskband contains two COM objects (designed by me and they are also doing fine). The problem i am facing is that if i right click a link in IE window, while my Deskband is selected, and click on "Open in New Window", then my Deskband also shows up in the new pane but it doesn't contain anything.
Please suggest me what to do!
regards,
|
|
|
|
|
Hello,
I'd like to create a toolbar (docked) with a width of 2 columns. I've searched newsgroups and the web, and all I can find is a way to set a CPaletteBar's width, via:
m_wndPaletteBar.SetColumns(AfxGetApp()->GetProfileInt(_T("General"),_T("Columns"),3));
I'd like to stick to a toolbar though - can it be done?
I'd like it to look like the paint program that comes with windows.
Also, when you pick the brush tool in Paint - you get a choice of brushes, I guess this is using a CDialogBar, but which control is it using?
Many thanks,
Josh
|
|
|
|
|
Dear Friends
My application which is in WINAPI doesn`t support 24bit color screen.it is wokring for all other options like 32 bit,256color etc.In 24 bit mode, I am getting garbled picture.
Kindly write to me how to solve it.
Thanking you.
Adarsh
|
|
|
|
|
I'm writing an unistaller and I want it to delete itself when all work is done. I tried to start a new tread but it finishes when the app exits. I need to ask the system to do the deletion. Can give me a solution how to do this or how to make the uninstaller if you have any other ideas.
|
|
|
|
|