You function return value ;) why const ? ;)
Mad__
Posts
-
"const" statement causes errors -
C++ programWhere you want change color : in control, in view, int title bar ... ? :)
-
Function for checking wheather the given unmber is IntegerDELIVER THE PROMISE wrote: input is Integer or float or char or keys like backspace And how do you want check float by one symbol ? ;)
-
DOS 16 bit client /server (C++)(maybe winsock)The one way is to implement TCP/IP protocol (in kernel level) :)
-
Creating a new windowTry crate simple SDI project using AppWizard and see deference with you code ;) You forget many ...
-
Help with program structuredo you know c++ class ? ;)
class CYOUView : public CView { int m_int; };
If you try compile that string:... GetActiveView()->m_int ...
you got error "m_int not member of class CView" but if you write:... ((CYOUView*)GetActiveView())->m_int ...
that will compile, and work whith no error's ;) -
One dialog after the other in mfc dialog appRemove m_pMainWnd assigment from CWinApp::InitInstance and will work
-
Help with program structureryuki wrote: As I see it there is no way to give the doc or view class access to the dialogbar class and the other way too. For MFC SDI applications :
((CFrameWnd*)AfxGetMainWnd())->GetActiveView()
return pointer to you CView class,((CFrameWnd*)AfxGetMainWnd())->GetAcviteDocument()
return pointer to you CDocument class. ;P -
Data Type conversion.CString((BSTR)data)
-
Data Type conversion.That meens, that you have not ASCII data stored by pointer. You mast know, what coding used (Unicode, MBS, BSTR, wide char), and corectly convert pointer to CString constructor.
-
Data Type conversion.simple (if there ASCII coded string ;) )
CString((char *)data)
-
How can I receive mails that is coming to my outlook in an MFC appliation.If you receive you mail from server using Outlook, you can find received messages in
C:\Documents and Settings\**{User name}**\Local Settings\Application Data\Identities\**id**\Microsoft\Outlook Express
(this folder may be changed in Outlook settings) If you planing to interact whith mail server from you program (not using Outlook), you mast implement needed mail protocol (like POP3,...) self ;) (see C++/Internet section on this site) -
Data Type conversion.You asking "how convert pointer to string", or "how convert data ref by pointer to string" ? And if data, you mast say what kind of data ;) (
unsigned short *
pointer may point to Unicode string, WORD value, 16bpp raster data ;) ....) -
Data Type conversion.That depend on what data type pointed by unsigned short*, etc. string, wide char string number ..., and what string representation you want. ;)
-
Owner-drawn CListBox-derived background color questionHi this is from MSDN :
The **WM_CTLCOLORLISTBOX** message is sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle.
-
I would like to convert int to charI don't understend what meen N in this code ;) For binare representation of value i use this function:
char* BinPrintf(int value) { char tmp[256]; memset(tmp, 0, 256); int tpos = 0; while(value) { tmp[tpos++] = 0x30+value%2; value = value >> 1; } char *ret = new char[strlen(tmp)+1]; memset(ret, 0, strlen(tmp)+1); tpos = strlen(tmp)-1; value = 0; while(tpos > -1) ret[value++] = tmp[tpos--]; return ret; }
-
Simple file I/O is giving me troubleHi For reading entire file content, try use block (not stream) i/o.
FILE *pFile = fopen(fname, fmode); // fmode = "r" for text files and "rb" for binary data fseek(pFile, 0, SEEK_END); long len = ftell(pFile); char *data = new char[len]; fseek(pFile, 0, SEEK_SET); long rest = len; long tpos = 0; while(rest) { long rd = fread(data+tpos, 1, rest, pFile); if (!rd) { // check error } else { rest -= rd; tpos += rd; } fclose(pFile)
-
I would like to convert int to charYou can use on of : sprintf, itoa ... of this pseudo code
int = nex_digit while(int) char = 0x30+int
-
I would like to convert int to charHy, That depend on what you need, char = 0x07 or char = '7' ;)
-
Very slow function free()Yes, you right, GlobalAlloc come from Win3.x, but hi work with whole address space, and if you have 256M free in phisical memory, hi get you memory block in phisic memory ;). And if you use VirtualAlloc function, you mast manage usage of pages. About speed : GlobalAlloc work some slower then VirtualAlloc, but i didn't think, that is critical (for 256M on Win2k diference less 1s).