|
how to change the stock backcolor property of ocx to window background color by default.. i changed it.. it works but the property browser in vb shows application backcolor under systems Tab... for ex. if vb form background is windowtitle... control shows windowtitle in the property browser... but i am getting the correct color in the control....
now my questiong is how to set windowback ground color as default color in my control?
|
|
|
|
|
Hi there, how do I have my application just to run single instance of it. er....eg. Restore the previous instance of the app and then exits.
|
|
|
|
|
When the app starts up, do a check for a mutex. if it doesn't exist create one, and if not then find the existing app and restore it..
something like:
CString strMutexName = _T("MyApp"); // can also use a GUID here
if (!m_hMutex) {
m_hMutex = CreateMutex(NULL, FALSE, strMutexName);
} else {
/* go through all the current windows and restore the existing version of your app. i can't remember how to do this now.. something to do with EnumWindow i'm sure, just don't use FindWindow (heard bad things about it ). */
}
hope this helps.
|
|
|
|
|
|
Using mutex is one way to do so, see MSKB: Q243953
|
|
|
|
|
Look at CSingleInstance in http://www.codeproject.com/library/pj.asp and the other related articles in the "Threads Processes & IPC" section.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
sometimes its nice to pass off the command line from the second
instance to the first. I usually do this with a control struct
in shared memory. First instance creates the control struct and
records its information there. Other instances, read the control
struct and record their command line there, then activate the
first instance, and notify it that their command line has been
recorded before exiting. The first instance handles these as
appropriate, perhaps opening another file, etc.
|
|
|
|
|
Hi all,
Here is a small description of my project:
Users shall be able to send print jobs to a print server. On the print server, the print jobs arrived shallt be managed.
My question/problem:
I need to find a way to restrain a print job from being automatically printed when it arrives to the print server. I am thinking about using “FindFirstPrinterNotification” and “FindNextPrinterNotification” to catch “PRINTER_CHANGE_ADD_JOB” and then immediately ask the print job to delete. Is this the correct approach?
Thank you,
zhu xiao yun
c++
|
|
|
|
|
Hello,
I am using OpenDocument in the Doc class to Load in a DIB. The Load function is in a Dib class I made. After I get this DIB, I want to draw it. I need to call the OnDraw function in the View class to call teh DIb class' Draw function.
I do not know how to send a message from the Doc class to the Load class, saying, "hey, we loaded a DIB, now Draw it"
Can someone please help me out?
Thanks
NickOne
|
|
|
|
|
|
im trying to open a file that is on a web server how can i do it?, i did this but it fails
CFile Arch;
Arch.Open("www.mypage/file.zip",CFile::modeRead);
|
|
|
|
|
use CHttpFile which can fetch files from the web
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Hey all.
I'm not a newbie to Windows programming or multi-threading, but I've been wondering: how exactly does the implementation of ::MessageBox(...) work?
I have a simple single-threaded application.
I call ::MessageBox(...) somewhere in the code. The message box APPEARS to be blocking the code execution, since the line after the "::MessageBox(...)" will only be executed after the message box is dismissed. However, my single-threaded application is still processing messages!
How is this magic performed behind the scenes?
Thanks!
|
|
|
|
|
Probably because your message loop continues to process messages such as WM_PAINT.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Actually, Cristian (and correct me if im wrong) but i dont see how yr message loop can be working if yr appliaction has called message box...
I think this is VERY good question for beginners like us.
Im sure that messagebox domodal, etc. call a hoorrible nasty "PeekAndPump" type MS fudge.
Any corrections?
Dave Carkeet.
|
|
|
|
|
David Carkeet wrote:
Im sure that messagebox domodal, etc. call a hoorrible nasty "PeekAndPump" type MS fudge.
Actually, from memory it sets a flag for the app so that the window stops responding, but the message pump keeps right on pumping. I think Nish said something similar, he may know more about it than I do.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
MessageBox is just a function which displays a particular dialog box, which a few bells and whistles.
From the documentation of ::DialogBox () in the Platform SDK:
"The function displays the dialog box (regardless of whether the template specifies the WS_VISIBLE style), disables the owner window, and starts its own message loop to retrieve and dispatch messages for the dialog box."
So, the function has its own message loop. It will also retrieve messages for the rest of your application
(e.g. WM_PAINT) and dispatch them to the appropriate handler. The MFC glue routes it eventually to your
routine (such as CView::OnDraw (...)).
Enlightened?
Iain.
|
|
|
|
|
I think it creates a mode dialog,and show it by DoModal(),so only if you
press OK or Cancel,the following codes will be executed.
Cheers
|
|
|
|
|
When a MessageBox is invoked, the parent window is disabled. Thus it cannot take mouse clicks or keyboard hits, BUT it can handle all messages sent or posted to it directly like the paint messages. When the MessageBox is dismissed the parent window is re-enabled!
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Hi.
I would like to switch the style of two buttons to/from default. For example, initial ButtonA is the default button. As the user selects an option in a dialog box, ButtonB becomes the default button and buttonA becomes a normal button.
I try changing the style of buttonB via SetStyle(BS_DEFBUTTON), however, that solution only highlights buttonB as though it is default. Nothing happens when I push Enter. When I push, Windows sends a message that buttonA is pushed. I set buttonA to default via Properties.
Do you have to set the current default button to something else before setting another button to default?
Thanks,
Kuphry
|
|
|
|
|
|
Interesting! You are right. I am trying to change the style of buttons belong to IDOK and IDCANCEL.
Kuphryn
|
|
|
|
|
Wow. Jeff Partch posted a response at MSDN Newsgroups and mentioned something about "HOWTO: Change or Set the Default Push Button in a Dialog Box." The solution is much more involved than I have anticipated.
Kuphryn
|
|
|
|
|
Okay. Pryrates of CodeGuru posted a solution that works flawlessly. A special thanks to Pryrates for such an elegant solution.
http://www.codeguru.com/forum/showthread.php?s=&threadid=197179
Here is the final code.
-----
void CDialog::SetDefaultBtnOk()
{
DWORD style = m_BtnOk.GetStyle();
// make sure ButtonOK is not already the default button
if ((style & BS_DEFPUSHBUTTON) != 1)
{
style = m_BtnClose.GetStyle();
// remove default push button style
style &= ~BS_DEFPUSHBUTTON;
// set the style
::SendMessage(m_BtnClose.GetSafeHwnd(), BM_SETSTYLE, (WPARAM)style, (LPARAM)TRUE);
// inform the dialog about the new default control id
SendMessage(DM_SETDEFID, m_BtnOk.GetDlgCtrlID());
// get the style
style = m_BtnOk.GetStyle();
// add the default push button style
style |= BS_DEFPUSHBUTTON;
// set the style
::SendMessage(m_BtnOk.GetSafeHwnd(), BM_SETSTYLE, (WPARAM)style, (LPARAM)TRUE);
}
}
-----
The second function SetDefaultBtnClose() is the compliment of the above.
Kuphryn
|
|
|
|
|
Hi i have a CWebBrowser in my dialog,
when i create it the vertical scroll bar is drawn but disabled
how can i make the scollbar disappear altogether and not be shown?
bryce
|
|
|
|