|
CString csText(_T("Unicode string"));
HGLOBAL hglbCopy;
// Open the clip board and set the data in to the clip board.
if( OpenClipboard(0) )
{
EmptyClipboard();
wchar_t *wcBuffer = 0;
hglbCopy = GlobalAlloc( GMEM_MOVEABLE,
( csText.GetLength() + 1 ) * sizeof (wchar_t) );
wcBuffer = ( wchar_t* )GlobalLock( hglbCopy );
wcscpy( wcBuffer, csText );
GlobalUnlock( hglbCopy );
SetClipboardData( CF_UNICODETEXT, hglbCopy );
CloseClipboard();
rgds
aneesh
|
|
|
|
|
Thanks aneesh.
but the problem is to converting CString to wchar_t * because the line :
wcscpy( wcBuffer, csText );
will cause thi error (in VC++ 6) :
error C2664: 'wcscpy' : cannot convert parameter 2 from 'class CString' to 'const unsigned short *'
The Main Problem !
|
|
|
|
|
Please put preprocessor defnition _UNICODE ( project->Settings->C/C++->Preprocessor->Preprocessor defnitions )
Rinu Raj
|
|
|
|
|
Thanks Rinu_Raj.
First : Then, I should add _T() to any string(LPCTSTR) that passed as an arguman for a function, is it right ?
Second : I got two errors :
1. error LNK2001: unresolved external symbol _WinMain@16
2. fatal error LNK1120: 1 unresolved externals
|
|
|
|
|
You may add wWinMainCRTStartup
Project->Settings->Link->Entry-Point Symbol wWinMainCRTStartup
Rinu Raj
|
|
|
|
|
Also if u didn't put _UNICODE definition, u cannot represent a unicode string in CString.
nave
|
|
|
|
|
Thanks All...
A little question :
Is there any another way instead of adding _T(), for each string, to convert them from 'LPTSTR' to 'wchar_t *' ? (I wrote a long code and now it's a little difficult to change!)
|
|
|
|
|
I migrated a project from VC++6 to vs2005. But I found to call vbscript
iActiveScript->SetScriptState(SCRIPTSTATE_CONNECTED);
in vc++6 it takes just less than 1 seconds. But in vs2005 it takes about 3 or 5 seconds.
There are about 30 vbscript to run and at each run I need to call
iActiveScript->SetScriptState(SCRIPTSTATE_CONNECTED);
So, finally in vs2005 it is slow down greately.
Does anybody have an idea what I should do to speed up in vs2005?
Many thanks!
Yong
|
|
|
|
|
I am using a manifest to give my program the xp style. For the most part, this works well and is giving me the look I want. However, a couple of CPropertyPageEx's have the old darker grey background. Code wise they relatively simple classes derived from CPropertyPageEx that contain some controls, etc.
One potential difference is that the page has a custom ctrl in it, although this doesn't seem consistent either as some pages with a custom ctrl are the lighter xp colour.
Any general thoughts as to how or why this would occur? I know that isn't much information to go on, but there doesn't appear to be much of a difference.
Any suggestions are greatly appreciated.
|
|
|
|
|
Does your control draw itself ? If so, then themes won't have any effect.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
The custom control does draw itself, but shouldn't the property page still adopt the xpstyle? The custom ctrl is doing it's own thing, that's fine, but the property page is still dark grey.
|
|
|
|
|
try the EnableThemeDialogTexture() function
eg. call it like EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB) when the a page is being initialized, with hWnd being the handle of the particular page....
ofcourse this funciton is available only for Windows XP
|
|
|
|
|
This option works, thanks. Is there anyway to accomplish this without the dll? It just seems odd that the other pages are adopting the xp style, while a couple are not. This seems like a bit of a hack to fix those couple of pages. It works, but it doesn't really spread light on why it's happening in the first place.
Thoughts?
Thanks for the post. Good solution for the time being
|
|
|
|
|
Well in my very limited experience this sort of problem occurs when tabbed dialogs are made in an 'unconventional' sort of way...e.g. like in http://www.codeproject.com/dialog/AndLawtabsetdlg.asp...
ofcourse it could be due to some other reason in your case;P...
|
|
|
|
|
I am completely frustrated. I am running Microsoft Visual C++ vers 6.0 and have created an application using the Microsoft App Wizard file/new, MFC Wizard(exe) module. It generates all of the "skeleton" code that will support menues, dialogs, etc. I am using it as: a Single Document, no Document/View architechture support, no document support, no features, no project style, pretty much a default application. The App Wizard generates the workspace and when I compile and run, I get two link error lnk2001, unresolved external references for On_Cancel() and OnOK(). I have tried all resolutions but still get the errors. What am I doing wrong and how does one find out where the variable are and why they are unresolved references. Any suggestions will help. Thanks at sid_kraft@msn.com.
Sid
|
|
|
|
|
That's odd. Are they on a class that has been generated ? Are there calls to On_Cancel and On_OK in the code ? Perhaps you can track down what is making it look for those calls, and perhaps you have to delete some code, or just add definitions for those methods to the class in question ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Anybody know how to store stuff in Windows Protected Storage? Outlook does it for email passwords, and IE stores autocomplete passwords there. But I have no luck trying to figure out the API via Google or MSDN. So am I missing something obvious, or is this an undocumented feature?
Thanks,
Mike
|
|
|
|
|
LsaOpenPolicy, LsaStorePrivateData are your friends.
Of course, this is WinNT and variants only, no Win9x/ME stuff here!
Steve S
Developer for hire
|
|
|
|
|
Thanks... Although I saw this in the function docs: Do not use the LSA private data functions. Instead, use the CryptProtectData and CryptUnprotectData functions.
I am currently using CryptProtectData, but that doesn't actually store the data anywhere. So I wonder why the rather strongly-worded discouragement
Thanks again,
Mike
|
|
|
|
|
Beats me. After all, DCOM relies on the LSA private data functions at the moment, as passwords are stored in there. Of course, you could CryptProtectData something, and then store it using LSA
I recently saw gadgets which combine a CF card reader and fingerprint scanner, or in one case a HDD and fingerprint scanner. That's my idea of security, although to be really safe, I'd want the scanner to be able to measure the O2 level in the finger as well, to be sure it wasn't chopped off. Paranoid? Me? Who's been talking??
Steve S
Developer for hire
|
|
|
|
|
Hi
i have to convert my project code from visual basic 6 to visual C++ 6 , so every thing is OK ,But there a litle proplem!
how i can create an ActiveX control include by example two buttons and combobox ? like visual basic user control because i have some user control like that and the user control its the primary reason to all of this procedure "convert to visual c++"
thanks for your pation!
-- modified at 19:44 Thursday 21st September, 2006
|
|
|
|
|
I whant to develope an aplication that overlays a bitmap with alpha to a full screen app but the thing is I don't know where to start
pls help
thanks ahead
|
|
|
|
|
shaderx wrote: overlays a bitmap with alpha to a full screen app
After reading that several times, I would say start with requirements and specifications.
led mike
|
|
|
|
|
i don't think i was clear enough
i whant to overlay to another apps window(that is full screen and its using directx , just like Fraps, if u know the program) or OpenGL
|
|
|
|
|