|
If you are programming in plain win32, you will have to send a WM_SETFONT to the control to change the font.
Vipin
http://www.explorewindows.com/Blogs
|
|
|
|
|
I show an example of this in the Extras section of this article.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I'm getting the following error
error C2664: 'PtrToInt' : cannot convert parameter 1 from 'size_t' to 'const void *'
at the line
sDirectory.assign(pszPath, PtrToInt((pCurrent-pszPath)/sizeof(TCHAR)));
The definition PtrToInt is present in the file basetsd.h as
#define PtrToInt( p ) ((INT)(INT_PTR) (p) )
where pCurrent and pszPath are both of type LPCTSTR. Any reason why is it so.
|
|
|
|
|
tom groezer wrote: pCurrent-pszPath
what are these values? seems you are caught with this.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Dividing by a size_t ( from sizeof ) is probably turning the pointer into a size_t. At least, that's my guess. Try
sDirectory.assign(pszPath, PtrToInt((TCHAR*)((pCurrent-pszPath)/sizeof(TCHAR))));
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
The second parameter of assign() is the number of characters to copy to the string, so all you need to do is pCurrent-pszPath . Pointer subtraction using pointers to T returns their difference as multiples of sizeof(T) , so dividing by sizeof(TCHAR) is wrong. (Assuming pCurrent and pszPath are TCHAR* of course.)
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Thanks for the input. The same is working on win32 platform.
|
|
|
|
|
I declared an int variable to an edit box.when i am trying to enter
-ve value it prompts that "please enter an integer".it is not allowing me to enter -ve sign.how can i prevent this prompt msg.
E-Ramu
|
|
|
|
|
You might have set range from 0-MAXINT
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
i didn't set any range and i didn't set the number proprty in the edit box properties as true
-- modified at 2:15 Wednesday 2nd August, 2006
E-Ramu
|
|
|
|
|
I am not sure but i think u cannot enter a -ve valu in a edit box whcih have number value set.
Another way is that derive class from the CEit and make that class as the member variable of the edit control. Overide the WM_CHAR message. This message will come when user enters a character into the edit box.
In that funtion check the character entered. Call the Base class( CEdit 's ) funtion only if it is a permitted character.
nave
|
|
|
|
|
Ramu.e wrote: I declared an int variable to an edit box.
Why? You need to use a CEdit variable for edit controls.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all,
OK, so yesterday some of you helped me with the the function LogonUser(). Thanx. But i'm struggling my but off with the last parameter. The thing is the last parameter is a Token, and I have no idea how to get this token a value. I have read all the documentation there is, but I would like a example. Plz someone help.
Thanx
Regards
Programm3r
|
|
|
|
|
It's an out variable, which means you need no pass any values for it. You will get a pointer to a to a token that represents the specified user.
You can pass like
HANDLE hUser = NULL;
LogonUser(....,...,&hUser)
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
The last onr is an out parameter. I.e that varaible returnds some value from the function..
eg..
HANDLE hToken = 0;
LogonUser( ..., &htoken );
nave
|
|
|
|
|
|
Hi, everybody. I'm a little stuck. I have no experience with DLL's and I'm trying to make something with'em.
I'm programming a dll (that calls a windows dll) wich contains the functions I want to use in my app. It compiles fine. But when I build my program that uses my dll, I get the next linking stage error:
MyProgram.obj : error LNK2001: unresolved external symbol "public: unsigned short __thiscall CMyProgramApp::OpenFile(class CString)" (?OpenFile@MyProgramApp@@QAEGVCString@@@Z)
Little help?
Znx.
Did you checked your TCP/IP settings? Enabled cookies? D'you want this dog?
|
|
|
|
|
Hi,
OK, I could be wrong on this one but, in my dll experience, it's because it cant find a certain function. I think it is the function in the dll you wrote. I would say try including the dll into program thats calling the dll you wrote. Hope it works.
Regards
Programm3r
|
|
|
|
|
|
You application should link with that library. which means, in your Project Properties (Settings) give lib file of the DLL. e.g SampleDLL.lib
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
u have to specify the lib file of that dll.
for that take project settings->Link tab
In the object/Library edit box give the name of the lib file. then try compiling.
nave
|
|
|
|
|
I have the following piece of code.
char* strFile = new char[50] ;<br />
CString str( "Hello\nCoders" ) ;<br />
strFile = str.GetBuffer( str.GetLength() );<br />
std::ofstream myfile;<br />
myfile.open ("d:\\example.txt");<br />
myfile << strFile ;<br />
myfile.close() ;<br />
delete[] strFile ;
The program throws a Debug assertion error at delete[] strFile ; . The function throwing the Exception is _CrtIsValidHeapPointer(pUserData) .
I was of the impression that creation with new must be followed by cleanup with delete . Seems like I am wrong or I did something wrong in the above code. Can anyone explain?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
Hakuna-Matada wrote: char* strFile = new char[50] ;
strFile = str.GetBuffer( str.GetLength() );
when the scope of the variable ends, the destructor of the CString variable will be called. as per the implemantation of CString if you call GeBuffer, you should call ReleaseBuffer before calling any other functoins in CString else it will throw a debug asertion. Here the destructor itself a "silent" function. Hope you clear
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
In addition to what sarath said
char* strFile = new char[50] ;
strFile = str.GetBuffer( str.GetLength() ); causes a memory leak.
char* strFile = 0;
strFile = str.GetBuffer( str.GetLength() );
this is enough. And dont call delete.
nave
|
|
|
|
|
In addition to Naveen said,
Use GetBuffer only if you are doing some modifications on the CString.
operator LCTSTR (const char*) has been overloaded in CString for reading purpose.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|