|
Nothing easier than that:
CString cstr;<br />
LPCTSTR lpString = (LPCTSTR)cstr;
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
No need to cast:
LPCTSTR lpString = cstr;
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
You don't need to convert anything, CString has an implicit LPCTSTR cast. If a function takes a const char* as parameter, simply take your CString.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
For unicode you better use the following
CString cstr;<br />
char * myString = (char *) (LPCTSTR) (cstr);
|
|
|
|
|
|
|
That is so wrong in so many ways.
First off, if it is a UNICODE build, then you will end up with a pointer to data such as.
0x65 0x00 0x66 0x00 0x97 0x00
To convert from a T string to a const char string, use the following macro:
T2CA (temp)
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
This is just wrong, whether UNICODE is used or not. If you need me to explain, let me know. Now it's quittin' time!
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
NO. Simply casting an LPCTSTR to a char * simply converts the pointer, not the characters. You must convert the characters, which requires using something like WideCharToMultiByte .
Software Zen: delete this;
|
|
|
|
|
XP saves all settings in binary files
located in windows\\system32\\config right?
i looking for some way to read these files?
i want to access registry from another os
|
|
|
|
|
If the other OS is Windows-based, you can use RegConnectRegistry() .
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
It is linux. so i need some code to do id
without windows API
|
|
|
|
|
Well, I don't know the format of any of the files that comprise the registry, so you may have a bit of work ahead of you.
Good luck.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Have you considered Winelib[^]? It may provide the Win32 functions you're looking for.
Otherwise, you might need to make your own limited version of the Remote Registry service to run on the Windows box.
- Mike
|
|
|
|
|
|
Hi,
I am nearing the completion of my app (and a big thank you to everyone here who has helped me so far - I've received a lot of help and do really appreciate it). I am currently working on saving project files, but there is one aspect of my app I have no idea how to go about saving, and would be very grateful for some advice.
Part of my app works a little like Windows Explorer. On the left there is a folder tree and on the right a file list. The user can create a file tree containing a number of files, and upon hitting a "Build" button, the folder tree he or she has defined is created on disk, and the specified files copied into these folders (you may wonder what the advantage of this method is over just letting my user do all this in Windows Explorer, but trust me that this makes sense in the context of the rest of my app - for instance, the paths of the folders are stored as command-line parameters etc).
So far, so good. However, when my user goes to save a project, the project must save the directory tree that he has created, and it is this that I do not know how to achieve. The directory tree is just a tree view - ie. a sequence of HTREEITEMs. On saving a project, the app needs to look at the tree view and save the structure, which can of course consist of an unlimited number of HTREEITEMS organised in any order with various properties. Upon loading a project, the app needs to be able to reconstruct this tree view just as it has been saved.
I thought of using a string array to hold the paths of the folders and try to reconstruct them from the paths, and using a number array to hold the properties, but this seems a very long-winded way of doing it.
Can anybody suggest a good method of dealing with this? I'm using the straight Windows API with _no_ MFC, but that shouldn't make too much difference as I'm not asking for code so much as for ideas about how one goes about storing information about something as complex and arbitrary as a customisable tree view.
Many thanks for any help,
KB
|
|
|
|
|
i would think u have to save the path names of the selected files along with the hierarchy info ... the tree view is only holding refs to those things in effect anyways
u should consider saving to an xml file as it is designed to represent hierarchical data after all
"there is no spoon" biz stuff about me
|
|
|
|
|
Hi,
I have written an app that controls another application - it basically packs its files, allows customisation of its window title and icon, adds an alternative splash screen and various other features specific to the app. The application my app controls is third-party, so I have no access to its code.
Everything is working fine, but I was wondering if there is a better way of changing the icon and window name at run-time than the methods I am currently using.
(Incidentally, I am using the straight Windows API with _no_ MFC.)
To change the window title, I have written this loop:
<br />
while(thirdParty_hWnd == 0)
{<br />
if(WaitForSingleObject(thirdPartyApp.hProcess,0)==WAIT_TIMEOUT)<br />
{ <br />
thirdParty_hWnd = FindWindow("thirdpartyappclass_mainwin",NULL);<br />
<br />
SetWindowText(thirdParty_hWnd, "New Win Title");
<br />
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
else<br />
{break;}
}<br />
The problem here is that the window title of the third party app does not appear in the window immediately, so my code sets the title before the app does. This means that the title is changed back a second or less after this code has been executed, meaning that I have to check the window title again in my next loop and change it back if necessary, like this:
<br />
char title_str[MAX_PATH];<br />
<br />
while(thirdParty_hWnd!=0)<br />
{<br />
if(WaitForSingleObject(thirdPartyApp.hProcess,0)==WAIT_TIMEOUT)<br />
{<br />
GetWindowText(thirdParty_hWnd,title_str,MAX_PATH);<br />
if(strcmp(title_str,"New Win Title")!=0)<br />
{<br />
SetWindowText(thirdParty_hWnd,"New Win Title);<br />
}<br />
<br />
//message loop here<br />
}<br />
}<br />
Although this works, the main problem is that this means the window title is set to what I want ("New Win Title" in the example) at first, then it reverts to the default app title briefly before getting changed back to, for instance, "New Win Title". Does anybody know of a better way of doing this, so that the original app title would never show at all? (Also, please bear in mind that I a relative novice, so feel free to tell me where my code is shoddy and suggest improvements.)
To change the icon, I use the following code:
<br />
SendMessage(thirdParty_hWnd, WM_SETICON,(WPARAM)ICON_BIG, (LPARAM)(HICON)NewIconBig);<br />
SendMessage(thirdParty_hWnd, WM_SETICON,(WPARAM)ICON_SMALL, (LPARAM)(HICON)NewIconSmall);<br />
(where NewIconBig and NewIconSmall are HICONs that point to an .ico file.
The only problem is that for this to work, the above code has to be contained in a while() loop (otherwise the icon is lost when you alt-tab etc). Although this works fine, looks good, and I have not noticed any slowdown, I am aware that this is probably not good practice to have a message sent to another window constantly. Is there anyway I can change the icon without having to continually tell the other window? (Note that in this case I cannot use an icon changer as the third party app has a built in checker that will cause the program to crash if any of its resources are changed.)
Any suggestions for improvements to my current methods would be much appreciated.
Many thanks,
KB
|
|
|
|
|
Hi,
I have been successful in getting tool tips to work with modeless dialogs.
I have a dialog with one button on it. I have attached tool tips to both the dialog and the button. When I put the mouse over the dialog, the tool tip comes and stays for a while as in standard windows.
However, when I put the mouse over the button, the tool tip comes up and quickly disappears. How can I make the tool tip for the button behave the same way as the dialog?
Thanks.
Martin
|
|
|
|
|
I guys
i have a question
can anyone point me to a piece of code that verifys if a mail is valid??
i have a mail list and i have to verify if the emails still exist.
I know that i have to connect to the mx server and ask to login, is the mail exist the server asks the password, if the mail dont exist the server fires a error
but i fellbehind on schedule and it wound be great if someone poit me to a working piece of code
thanks
MSN:maxsnts@hotmail.com
|
|
|
|
|
Hi!
I have InstallShield for Visual C++ 6.0 and today is the first time I have tried to use it.
Quickly I had my executable in an installable format but it also needs some DLLs I have written. I create a file group called "Libraries" and put my DLLs in it and then mark the file type as containing all self-registering files.
So I have now two file groups:
1. Program Executables
2. Libraries
I build my project and install it. Everything in "Program Executables" is copied to my directory but "Libraries" are ignored. How do I get InstallShield to install my DLLs and register them?
Also can anyone tell me how to tell InstallShield to create some registry entries.
Last, does anyone know a quick tutorial?
Thanks to all!
|
|
|
|
|
Hi!
I have Installshield for VC++ 6.0.
|
|
|
|
|
I am new to the field of VC++....can anyone please tell me as how to create a program that reads a text file, line by line....and if possible how to read each line starting from a particular character to a specified number(of characters)
|
|
|
|
|
one place to start would be to look at msdn.microsoft.com for iostream and fstream.
*.*
cin >> knowledge;
|
|
|
|
|
Hi! Keegan
I realy don't understand what you wanted to say...was just going through what you told me , but to no avail.....
|
|
|
|
|