|
yes handle the BN_CLICKED message with something like this:
void CMyClass::OnClickMyButton() //just example
{
if ( ((CButton*)GetDlgItem(IDC_RADIO1))->GetCheck() )
{
AfxMessageBox("radio1 checked");
} else
{
//check radio button 2 & 3
}
}
|
|
|
|
|
Hi friends,
i want to convert from bmp to 32 bit Gif file, any body help me
|
|
|
|
|
there is no such thing as a "32 bit GIF"
-c
|
|
|
|
|
I currently have visual c++ 6.0 pro, but I now need to use visual basic as well, i was wondering if i purchase the visual studio .net pro 2003 upgrade pack, would i get c++ .net, and vb .net?
|
|
|
|
|
How is this done? If you try to resize the combobox using either MoveWindow or SetWindowPos then the only thing that changes is the height of the dropdown or the width of the control but the height of the control in undropped state is a constant. And I need to calculate it at runtime, assuming this value changes if the user has a different theme than I do on my machine.
I suspected that GetSystemMetrics might help but apparently no value returned from that function matches the height of a combobox. Could it be a combination of some values?
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Have you tried CWnd::GetWindowRect()?
CRect rc;
m_cbNames.GetWindowRect(&rc); // m_cbNames is mapped to a CComboBox control
TRACE("The height of the combobox is %d\n", rc.Height());
|
|
|
|
|
i am not really sure what you're after here. i mean if you're looking for the static height of a control you can just use
<br />
CRect rc;<br />
::GetWindowRect( hWnd, &rc );<br />
rc.Height();<br />
If thats not what you're looking for try to elaborate a bit.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
What are you trying to do? When you create a Combobox [or dropdown list] the height is dinamic, in other words it adjust to the closest size (resolution and operating system dependent) to the one you set it to in the resorce. There is no reason I can think of to do this out side the resorce editor, even if you are doing are doing a custom combobox.
If the problem is realy using the resorce editor then after you have placed the combobox control on your dialogbox then click on the arrow [that is displayed on the control in the dialogbox]. This will show you a sizing rectangle that will allow you to specify the perfered size instead of the single line height, which is the default height of the dropdown box.
Trust in the code Luke. Yea right!
|
|
|
|
|
I've got a little problem with messages.
I have a .dll that sends messages to an MFC app. The problem is the MFC app recieves theses messages more than once for everytime the .dll sends the message. The .dll uses PostMessage.
Is there anyway that I can make the MFC app call the handle once for everytime the PostMessage in the .dll is called.
The amount of times the MFC handle gets called is quite random depending on what else is happening on the system I can get it between 2 and 7 times.
Thanks
Darren
|
|
|
|
|
How about using something like:
while (GetMessage(&msg,NULL,0,0))
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
-Nick Parker
|
|
|
|
|
In your EXE's message handler for a particular message, try using a member variable that denotes busy or not busy.
ON_MESSAGE(WM_SOMEMSG, MyMsgHandler)
LRESULT MyMsgHandler( WPARAM, LPARAM )
{
if (! m_bBusy)
{
m_bBusy = true;
...
m_bBusy = false;
}
}
|
|
|
|
|
You have one of 2 problems:
1) Ether your program is requesting that the dll send the message twice.
2) Or the dll is actualy sending the message twice.
If you wrote the dll then you need to look at the code for it to find out what you did wrong.
If you did not write the dll then you need to find out what you did wrong in your program.
Work arounds:
If you did not write the dll file and you are absolutly sure that your program is not responsible (unlikely-but posible) then you need to set a flag, or use some other method, to determine if you have already handled the (exact same) message. The only problem with using the flag method is determining when to clear the flag so that you do not ignore the next valid message.
Again if you did not write the dll I would recommend saving the message (the Msg,wParm, and lParm) so that you can make absolutly sure that it is not the same message you received previously.
The method of setting a static flag inside the function/method its' self only works if you received a new message while you are still precessing (buzy) the previous message. (Exp: If want to prevent multiple occurances of an error dialog then write a function/method
for diplaying an error dialog that sets a static flag so that all other calls will be ignored until the user answer closes the first error dialog).
Trust in the code Luke. Yea right!
|
|
|
|
|
Thanks for all the answers. I've now approached the problem from a different angle and got it working.
Thanks for all the help
Darren
|
|
|
|
|
Due to the possibility of virus attack on 26th April last week, we changed the dates of all computers in our office LAN. And on 27th when the danger is over, we restored back the correct dates and times.
Since then we are having trouble on computers where Visual C++ 6.0 is installed. Problem is that whenever someone makes a slight change in *.h or *.cpp file of his project, Visual C++ starts rebuilding the entire project again. And after successful rebuilding, when we try to run the program, Visual C++ IDE again asks us that some files need recompilation
This problem is really irritating because for just a small change in a file, the entire project is getting rebuilt by the IDE. We tried everything, we deleted all the compiler generated temp files, program database e.t.c but nothing is working for us. This problem is present on every computer on out network where VC++ 6.0 is present. Any one wants to give advice ???
|
|
|
|
|
This may be a dumb question, but did you also delete the .obj files?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
but did you also delete the .obj files?
Yes i deleted all the files. The ones left were *.h, *.cpp, *.dsp, *.dsw
|
|
|
|
|
maybe the virus messed up the 'modified date' attribute of the files ..
|
|
|
|
|
Do any of the files still have a future date? This happened to me just yesterday. Someone from another TZ ahead of mine sent me some files. Some of the files were dated several hours ahead of my current time. Everytime I went to run the program, I was asked if I wanted to rebuild it. I finally went to the folder to find what file was dated in the future, opened it up, made a change, and re-saved the file. Problem solved.
|
|
|
|
|
I hope you backed up the your work space (.dsw and .dsp files at the very leasted).
If your company [or you} was realy worried obout the virus attack then some-one should have asked the administrator for a daily backup (of your projects files).
The statement "of his project file" sounds like you all are using different project files.
Check the date (and time) of all your files.
Have every one involded with the project recompile thier portion of the project. If the problem does not go away after that then you better (ask the administator to) scan the server.
Trust in the code Luke. Yea right!
|
|
|
|
|
Hi
I want to be able to check wheither the program is already running, so i don't want the program getting executed more then 1 time. The user should only get 'the second or more times he tries' a messagebox or some information that the program is already running on the system and has to be shutdown first to be ran.
Greetings
Jens
|
|
|
|
|
|
yeah seems like that class was exactly what i was looking for.
Thanks Rage!
And btw, do you happen to know a class which can return the current CPU id. I need that id to implement some security. (don't like this method of working though )
Greetings
Jens
|
|
|
|
|
JensB wrote:
yeah seems like that class was exactly what i was looking for.
If you need it, try and download it from PJ's website directly, I think the version is updated.
JensB wrote:
And btw, do you happen to know a class which can return the current CPU id. I need that id to implement some security. (don't like this method of working though
Maybe you could use GetSystemInformation.
Quoted from MSDN :
The GetSystemInfo function returns information about the current system.
VOID GetSystemInfo(
LPSYSTEM_INFO lpSystemInfo
);
typedef struct _SYSTEM_INFO {
union {
DWORD dwOemId;
struct {
WORD wProcessorArchitecture;
WORD wReserved;
};
};
DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress;
LPVOID lpMaximumApplicationAddress;
DWORD dwActiveProcessorMask;
DWORD dwNumberOfProcessors;
DWORD dwProcessorType;
DWORD dwAllocationGranularity;
WORD wProcessorLevel;
WORD wProcessorRevision;
} SYSTEM_INFO;
Check it out directly in the MSDN for more info about the struct members.
Hope this helps.
~RaGE();
|
|
|
|
|
ok i will check it out directly @ msdn
I've downloaded the latest CSingleInstance v1.12 and implemented it on a new mdi application and it worked great.
BUT
When i try to implement it to my existing application, it doesn't work
i'll paste the appnameApp::InitInstance here:
CFile f;
SetRegistryKey("Company");
SetDialogBkColor(); // set dialog background color to gray
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
AddDocTemplate(new CSingleDocTemplate(IDR_MAINFRAME,
RUNTIME_CLASS(CMyAppNameDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMyAppNameView)));
int iNrOfDialog = 1;
BOOL bGoOn=TRUE;
CDialog *pDialog;
int pushed;
m_bFromMain = false;
while (bGoOn)
{
switch (iNrOfDialog){
case 1:
{
pDialog = new CDlgWelcome2();
pDialog->DoModal();
delete pDialog;
pDialog = new CDlgWelcome();
pDialog->DoModal();
delete pDialog;
pDialog = new CDLogon();
pushed = pDialog->DoModal();
switch (pushed)
{
case (NEXT):
iNrOfDialog++;
break;
case (EXIT):
bGoOn = FALSE;
b_mExit = true;
break
}
delete pDialog;
break;
}
case 2:
{
pDialog = new CDlgList();
pushed = pDialog->DoModal();
....
so this code i don't have:
CMainFrame* pMainFrame = new CMainFrame;
m_pMainWnd = pMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
I've pasted the following code:
CInstanceChecker instanceChecker;
if (instanceChecker.PreviousInstanceRunning())
{
AfxMessageBox(_T("Previous version detected, will now restore it"), MB_OK);
instanceChecker.ActivatePreviousInstance();
return FALSE;
}
That i have put totally in the beginning of InitInstance.
And then before i go into the while repeating:
instanceChecker.TrackFirstInstanceRunning();
When i execute the program (use vc5) it gives an error on the line when i call the 'trackfirstinstanceRunning()'.
debug assertion failed:
sinstance.cpp
line: 145
What is on line 145:
ASSERT(AfxGetMainWnd() != NULL); //Did you forget to set up the mainfrm in InitInstance ?
I don't yet have a mainfrm, but a welcome form + logon form.
When can i know when the mainfrm is setup?
Any ideas?
|
|
|
|
|
ah sorry
i have put the trackfirstinstancerunning() at the end of InitInstance and now it works great (because then you have a mainwindow)
Anyway, thanks for the article
|
|
|
|