|
You can't save it as a CString, the registry has a limited amount of variables you can save data as....CString isn't one of them. Check out MSDN for the types....
|
|
|
|
|
Well if LPTSTR str how can I get a CString value into str??
|
|
|
|
|
GetBuffer(0) and ReleaseBuffer
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Larsson wrote:
(unsigned char*)&sTest
pass in the CString, not the address of the CString. The CString's LPCTSTR() operator will take care of passing the pointer.
(unsigned char*)sTest
Also, I do not see where you set the value for dwSize. It must be the length of the string, plus 1 for the terminating NULL.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
It must be the length of the string, plus 1 for the terminating NULL.
The size is in bytes, so for a Unicode build, you have to double it. Safest way is to use
dwSize = (sTest.GetLength() + 1) * sizeof(TCHAR)
|
|
|
|
|
You are correct, but Larsson was casting it to an unsigned char* so he is not using Unicode. Introducing TCHARs in the answer would more than likely confuse a beginner.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Given how it's used, casting to char* doesn't say anything about the build. RegSetValueEx takes CONST BYTE* as the fifth parameter, so a CString passed in would *have* to be cast in a Unicode build (preferably to BYTE* , but since BYTE is typedef'ed to unsigned char anyway, casting to unsigned char* works).
|
|
|
|
|
hi everyone. Im trying to get flash working on my desktop using the shockwave actvex control.
Essentially i want to have the activex control there but with its container window completely invisible. I cant seem to get both of these happening at the same time.
Would this just be a matter of choosing the right window options or would i need to take control on the background of the window?
help
|
|
|
|
|
maruku wrote:
Essentially i want to have the activex control there but with its container window completely invisible.
You can't. If you make a window invisible, it's children will be invisible as well.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for the reply Ryan but this is definately possible. I have played with a 3rd party program that turns shockwave movies into Windows apps and you can certainly make the window invisible.
Perhaps i need to override OnPaint, or OnEraseBackground to simulate the invisibility myself??
Maruku
|
|
|
|
|
That's what you'd have to do. You can't use Windows to make a parent invisible and its children visible, so you'll have to subclass the parent window and do no drawing (not just in OnPaint() /OnEraseBackground() , but anywhere), and also add the WS_EX_TRANSPARENT extended window style so that mouse clicks go "through" the window to the window underneath.
Be careful with your definitions. There is a difference between an invisible window (one hidden with ShowWindow() ) and a window that you simply don't paint. For instance, if I create a top-level window that covers the entire screen and don't do any drawing, then whatever is underneath it will be visible (it will be "invisible") but it will still capture mouse clicks and prevent the user from interacting with any other windows. If the window is hidden with ShowWindow() , it doesn't have any side-effects.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi,
i got this control on a dialog, how can i initialize it to be null when i first open my window?
|
|
|
|
|
That depends on what you mean by 'initialize it to null'.
If you want to initialize the control, do it in the OnInitDialog() handler of your dialog class. You can use CDateTimeCtrl member functions like SetFormat and SetTime to set the format and content of the control, respectively.
If you want to hide the control, and then show it later, you can also do that in the OnInitDialog() handler. Just call the control's member function ShowWindow(SW_HIDE) to hide the control, and then ShowWindow(SW_SHOW) to show it.
Software Zen: delete this;
|
|
|
|
|
i ment that i want that the control to be blank (empty) with no date on it.
can it be done?
|
|
|
|
|
I m Using VC++ 6
I want to make SETUP of my application .
to instal it on client.
How can i do it . any tool ??
thanx
|
|
|
|
|
you can use windows installer, it should be included in visual studio.
Eugi Games
|
|
|
|
|
I guess this will be the July "Which setup program is best" thread....
I use Inno-Setup from http://www.jrsoftware.org/isinfo.php[^]
You will find that IS-Tool http://www.istool.org/[^] is a good script editor if Inno-Setup.
You can start simple and add on as your needs expand. Their support via news-groups is excellent.
Best yet! I'ts free.
The only downside is that if you're going for the Windows Logo, it doesn't create .MSI setups
|
|
|
|
|
Im building an MDI app that retrieves and updated data from/to a database.
for each table i want to have a childwindow.
i open my childwindows with the main menu.
in each childwindow i want to have a grid table (datatable childwindow) that shows the table's data and an Edit button that will open another window (Update childwindow) with textfields for the user to update the data.
my question is - bcuz i want this to be MDI, should i use Doc/View for the ? and if so, should the Update child window should be Dialog or also Doc/View like the datatable childwindow?
any suggestions?
|
|
|
|
|
If you are editing data on a view, and don't edit it directly (such as in an editable database grid), then you should of course use a dialog - see my earlier window. Synchronizing will be more difficult otherwise, you'll have to do lots of unusual stuff to get the modal behaviour you get for free with a dialog.
You should also use Doc/View - you get lots for free as regards application management with it.
|
|
|
|
|
I am trying to add the TextToSpeech control to the MS Developer Studio (VC++ vers 4.0) Dialog Editor control set. I followed the instructions given in a posting referenced by The CP "Threads with MFC" tutorial by Aria Ansari as follows:-
"Downloading the MS speech API (now at ver.5) did not work for me.
Here is what I did to get the TextToSpeech control to appear as a registered activex control
(this is a much smaller download too).
1. Look for the file c:\windows\speech\xvoice.dll.
If you have this file, go to step 3.
2. Download the speech control and run the actcnc.exe program
you'll find this at: http://activex.microsoft.com/activex/controls/agent2/actcnc.exe
3. Register the activex component.
Open a console window (Start->Run->cmd)
cd \windows\speech
regsrv32 xvoice.dll
Hope this helps those"
I actually ran c:\MSDEV\bin\regsrv32 xvoice.dll. The registration all ran very quickly but seemed to be successful. However, I don't know how to get the control to appear in the Dialog Editor -the instructions in the article are:-
"Step 12:
Open the resource view and double click on the Dialog resource ID of your newly created dialog ,in order to open the dialog editer.
from the main menu choose:
Project ->Add to Project->Components and Controls...
Step 13:
Now the "Components and Controls Gallery" should be opened, double click on the Registered ActiveX controls folder. Choose and insert the TextToSpeech class and close the "Components and Controls Gallery".
Version 4 of Developer Studio only seems to have Insert->Components. What SHOULD I be doing in ver4.0 of Developer Studio to get the control added ?
Any help would be appreciated
Doug
|
|
|
|
|
how can i get the last boot time?
any API 's ?
[ there is one -> statistics Server/client switch in net.exe , but i need to do it in my program.]
mind is everything.
|
|
|
|
|
GetTickCount[^]?
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
that is a DWORD and i tried that earlier, that resets when overflows.
any other idea ..like any registry values ?????
or event log???
mind is everything.
|
|
|
|
|
On Windows NT or above, you could query the value of the System\System Up Time performance counter (which gives system up time in seconds) and work backwards from that. See this article [^]for information on reading performance counters
|
|
|
|
|
I need to convert CString value to const char *. I do the same in following way. I also tried with LPCTSTR, still i get same error.
CString filename;
FILE *fptr;
m_fileName.GetWindowText(filename);
int nLen = filename.GetLength();
LPTSTR lpszString = filename.GetBuffer (nLen );
fptr = fopen( lpszString, "r" );
But i get error as
fopen' : cannot convert parameter 1 from 'unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
i need ur help to sole this issue.
|
|
|
|