|
I want to open a window,that will have a text field,several "combo box" with some options,a "Ok" button, and another field where I want to show an image(initially empty). After selecting the desired options and pressing the "Ok" button,I want to show an image. The image shown will deppend on the options. Can you tell me please how can I do this?
(*Clarification*: The image is not an image on the disk,but something that will be generated from the options selected)
|
|
|
|
|
Make the image a bitmap, assign it a name, like IDC_IMAGE. In the class wizard, go to member variables and Add Variable, and make it a control called m_image. Then import or create the bitmaps you want.
In the Init Dialog section after it says, add extra initilization here, put
VERIFY(picture1.LoadBitmap(IDB_MYPICTURE1));
VERIFY(picture2.LoadBitmap(IDB_MYPICTURE2));
Create two variables of CBitmap type and name them picture1 and picture 2.
Then, in the part where you make your choice,
if (buttonpressed==1) m_image.SetBitmap(picture1);
if (buttonpressed==2) m_image.SetBitmap(picture2);
I don't think I left anything out, and this works for me in visual c++ 6.
Dimenser
|
|
|
|
|
I have something like this:
CDC* my_DC;
my_DC = new CDC;
my_DC -> CreateCompatibleDC(NULL);
my_DC -> PatBlt(0,0,my_size,my_size,WHITENESS);
for (int i = 0; i < my_size; ++i )
for (int j = 0; j < my_size; ++j )
if (result[i][j])
my_DC->SetPixel( i, j, RGB(0, 0, 0));
How can I make a Bitmap from that?
Thanks!
|
|
|
|
|
im trying to use a Print("") function with my own lang. it finds the Print("") but wont print whats between the "".
heres the code.
if(!strcmp(parsel.c_str(),"Print(\"") || !strcmp(parsel.c_str(),"Print (\""))<br />
{<br />
<br />
<br />
int at = parsel.find("Print(\"",0);
int at2;
bool flag = 1;
<br />
if( at = string::npos)<br />
{ <br />
flag = 0; <br />
at2 = parsel.find("Print (\"",0);<br />
at2 += 8;<br />
}else<br />
{at += 7;}<br />
<br />
while( flag )<br />
{<br />
at++;<br />
int pos;
bool run = 1;
while( run )<br />
{<br />
string test = parsel.substr(at, 1);<br />
if(! strcmp(test.c_str(),"\""))<br />
{ <br />
at++;<br />
pos++;<br />
}<br />
else{ <br />
run = 0;<br />
at = at - pos;<br />
string tmp = parsel.substr(at, pos);<br />
cout << tmp;<br />
}<br />
} <br />
}<br />
if(! flag)<br />
{<br />
at2++;<br />
int pos;<br />
bool run = 1;<br />
while( run )<br />
{<br />
string test = parsel.substr(at2, 1);<br />
if(! strcmp(test.c_str(),"\""))<br />
{<br />
at2++;<br />
pos++;<br />
}<br />
else<br />
{<br />
run = 0;<br />
at2 = at2 - pos;<br />
string printer = parsel.substr(at2, pos);<br />
cout << printer;<br />
}<br />
}<br />
}<br />
<br />
} <br />
}
|
|
|
|
|
|
I am using Marc's EasySize.h for easy resizing of controls within a dialog-based application. I need help with getting the message map right for the following controls:
1) I have two list controls side-by-side that I want to resize proportionately to the resize. How do I code the message map for the easy size?
EASYSIZE( control, left, top, right, bottom, options )
2) Also in the dialog I have 5 buttons that are lined up on the bottom of the dialog centered horizontally. Can someone help me get the message map right for these controls as well?
THANKS!
|
|
|
|
|
Can u be a bit more specific about ur question? what exactly do u need?
Do you want to know how to resize the controls, or how your function works?
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
If you download the source code of the following article , you will see examples of different alignments of controls.
- Michael Haephrati מיכאל האפרתי
|
|
|
|
|
visual C++
1. i have created a dialog based project COldDlg.
2. then i added a new dialog resource CNewDlg.
3. i need that the old dialog sees the new one and controls its member variables and when the OnOK() of the new dialog executes it returns to the old dialog.
in other words i need to achieve the following commands:
COldDlg::OnCalculate()
{
CNewDlg dlg2;
dlg2.DoModal();
m_new=m_old;// where m_old,m_new are 2 member variables of the old and new dialoge respectively
}
when i made the above statements the builder tells me that CNewDlg is undefined declaration.
can anyone give me a detailed answer(in steps and forward plzzzzzzz)
i can rebuild the new dialog again if needed
|
|
|
|
|
Your example is incomplete. What are m_new and m_old?
Kuphryn
|
|
|
|
|
At the top of the main dialog portion, you need to add
#include "dlg2.h"
to pass the variable, use m_old=Dlg2.m_new;
Dimenser
|
|
|
|
|
visual C++ 6
can anyone plz tell me (in detailed steps) how to add a vertical scroll bar to my dialog based project?
|
|
|
|
|
|
I would appreciate If someone could tell the correct way to dtermine the version of MSOffice 97-XP installed and service packs(of course programmatically).
Thanks
Yeghia
|
|
|
|
|
have a look at the registry, I'm sure you will find something.
Don't try it, just do it!
|
|
|
|
|
The funtions to help you are:
DWORD GetVersion(VOID); Gets the version number of the operating system.
BOOL GetVersionEx(<br />
LPOSVERSIONINFO lpVersionInfo
); Gets the version of the current operating system
lpVersionInfo [in/out] Pointer to an OSVERSIONINFO data structure that the function fills with operating system version information.
Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of the OSVERSIONINFO data structure to sizeof(OSVERSIONINFO).
Windows 2000: This member can be a pointer to an OSVERSIONINFOEX structure. Set the dwOSVersionInfoSize member to sizeof(OSVERSIONINFOEX) to identify the structure type.
Do check at www.msdn.com for detailed and updated description of the above functions
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
Hello,
I have a MFC property sheet dialog baised application (a wizard.) I need to use data entered into the second page on the third... does anyone have any information on how I do this?
|
|
|
|
|
The PSM_QUERYSIBLINGS message might be of help to you.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Typically, there is one instance of a class representing the property sheet or wizard that is derived from CPropertySheet, and this has member variables of a class derived from CPropertyPage. Within one CPropertyPage instance, you can use GetParent(), which returns a pointer to your CPropertySheet, but it is typed as a CPropertySheet*, so you need to cast to to a pointer to *your* derived CPropertySheet class. From that, you can access all the children pages, and the member variables and functions within each child page.
|
|
|
|
|
Here is a silly question for you, Graham (can you tell I'm a noob?): How do I cast it to a pointer to my derived class?
|
|
|
|
|
In one of your classes derived from CPropertyPage:
CYourDerivedClass* pYourDerivedClass = (CYourDerivedClass*) GetParent();
|
|
|
|
|
Hi,
how can I make a asynchronous function call?
I want to call a member function of class B from class A, but asynchronous.
my thoughts:
1) using a class C which runs as a thread. Class A starts the thread and C then calls the function of class B.
2) creating a window in class B and sending a messages to B using a message pump
Are there any better ways of doing this?
Thanks
|
|
|
|
|
Why do you want to do this exactly?
PostMessage would be the easiest way. You could just post your CMainFrame class and get it to despatch to the appropriate class. The 'this' pointer could be included as a param to PostMessage().
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Why I want to do this:
I have gota class A with an array of class B items.
Class B owns two items of class C. Class C runs in a thread.
When the thread of class C ends, I want A to remove B from its array. So I must call a function in A from within C (just before the thread terminates). But the function call can never return to C, because it will be killed during this call. So I think this will not work properly. That's why I want this call to be made asynchronous. So the function will return.
Chris
|
|
|
|
|
Does sound like a good approach. One possible solution would be to get C to call A and tell it that C is no longer valid. Then let C delete itself. Next time A tries to access B/C it will test this flag and no it can't. Something along those lines. Or maybe use smart pointers.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|