|
Bad assumption. You should use the ntohXX functions to convert from network format to host. You never know, one day you will write code that isn't destined to run on an x86 box.
I migrated stuff between m68k, x86 and Sparc. Trust me on this, it's not fun.
Steve S
|
|
|
|
|
ntohXX functions are very very slow, you shouldn't use them at all, I've written an own version with does the whole job with about 10 clocks.
Don't try it, just do it!
|
|
|
|
|
which, presumably, are using either handwritten assembly functions, or inline assembly?
Which kind of defeats the purpose, which is platform-endian neutrality.
I didn't say they were speed efficient, but they help you produce portable code.
Steve S
|
|
|
|
|
I have a database program, and a dialog box that is full of Edit Boxes. After clicking the 'add new record' button, I would like the cursor to go back to the first box in the window.
If the first edit box is edit1, would you call something like SetCursor(edit1) or something like that?
Thanks!
Dimenser
|
|
|
|
|
GetDlgItem (edit1)->SetFocus();
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
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?
|
|
|
|