|
yes, i made sure lnRes was ERROR_SUCCESS....,
i actually didnt catch a return from RegDeleteKey()
ill be messing w/ it some more tonight, and if I cant figure it out
ill be sure to include that in my next post.
todo....
:: insert inspirational text here ::
|
|
|
|
|
What operating system are you using? If I remember correctly deleting keys works differently in win9X than NT. Are their any values inside the key?
John
|
|
|
|
|
98SE at home, where im developing this app.
MSDN said...
Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95, Windows Server 2003, Windows 2000 Server, and Windows NT Server.
??
todo....
:: insert inspirational text here ::
|
|
|
|
|
Yes, it is included in all operating systems but functions differently. I beleive it depends on if the Key has values. In one operating system it removes the whole tree in another it does not.
John
|
|
|
|
|
i browsed through it , i probably shouldve read better, i thought I could just specify a subkey to delete with an initialized key handle, but i see its not that easy
HKEY hKey;
LONG lnRes = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0L,
KEY_ALL_ACCESS,
&hKey
);
LPCTSTR keyname = "xlaunch";
RegDeleteKey(hKey, keyname);
RegCloseKey(hKey);
xlaunch is my subkey, that i created beforehand in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
??
i may not even have the concepts right than, but i thought the hKey was the main key, xlaunch would be my subkey that hold the data.. ?
this is my first attempt at windows registry manipulation
todo....
:: insert inspirational text here ::
|
|
|
|
|
I believe there is a free class here that will delete the key correctly.
John
|
|
|
|
|
The implementation I have now is rather un-efficient, just wondering if you know of a better way?
1) Make copy of CString
2) Find all \'(escaped single quotes) and replace with placeholder *'s
3) In a while loop find existing single quotes and take note of start and finish indexes
4) each start and finish pair will be extracted and further analyzed
This is a quick and dirty approach but I like optimized. I Don't expect anyone to bother sitting and trying to optimize it for me, but if you've had experience in extracting strings from strings please show me how in some simple code
Thanks
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Hockey wrote:
2) Find all \'(escaped single quotes) and replace with placeholder *'s
Does CString::Replace() help? I'm not sure if "escaped" was intentional or not.
Hockey wrote:
...extracting strings from strings...
These CString methods come to mind:
Find()<br />
Left()<br />
Mid()<br />
Right()
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Basically I have a CString which holds a PHP code. I need to be able to record the index of the start and end of a string inside the CString itself (single quoted and double quoted strings). Like most languages PHP does not consider escaped quotes to mean END OF STRING. So I need to devise code that basically starts at the index zero of the string(buffer) and iterates each token(character) and when it finds a single quote(not escaped) it records it's index in the string and repeats iterating until it hits a closing string(not escaped) and record that index too...then i'll use CString::Mid() to pull the data out of CString buffer and analyze it.
I can't for love nor money figure out how do get this done
I'm drinking triples, seeing double and acting single
|
|
|
|
|
You could do a CString::Find for the quote, and loop until you find one that is not preceeded by a '\':
pos = mystring.Find ('\'');<br />
if (pos > 0 && mystring[pos - 1] != '\\')<br />
found it!
Do that to obtain both the start and end positions, and extract the contents.
|
|
|
|
|
Hockey wrote:
So I need to devise code that basically starts at the index zero of the string(buffer) and iterates each token(character) and when it finds a single quote(not escaped) it records it's index in the string and repeats iterating until it hits a closing string(not escaped) and record that index too...
CString str;
int nStart = str.Find("\\'");
int nEnd = str.Find("\\'", nStart + 1);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Dear all:
I need regex's head file and lib file.But I can not find it.
Could you pls give me the address to download?
Thanks!
|
|
|
|
|
A bit more information about which regex library you are looking for would be helpful.
You might try boost::regex, available from www.boost.org
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
|
I have a release build in VC6, with Optimizations on for Maximize Speed
I have a DLL that is loaded dynamically, which calls a member function of a class that is declared (and exported ) from another (also built in release).
The function adds an entry into a std::map
where the map is a member variable of the class and declared map<std::string,std::string>
This crashes within the STL impl of the map.
If I turn off the Maximize speed option it works fine.
Any suggestions as to how to track this down? I have seen something like this before where direct access to the map is allowed, but in this case it is not made publicly available - all access is wrapped with methods of the class.
I have rebuilt things several times from scratch and still have the error. 2-3 weeks ago everything was working fine. Crap
Any suggestions are most welcome at this point
Thanks
<i>¡El diablo está en mis pantalones! ¡Mire, mire!</i>
<i>Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!</i>
<font size="1" color="black">SELECT * FROM <b>User</b> WHERE <b>Clue</b> > 0
<b>0 rows returned</b>
</font>
|
|
|
|
|
You can compile software in release mode, but with debug symbles. This may help you track the
fault down. For example memory is allocated with room at each ends in debug mode, but not in release,
thus hiding bugs...
Look for "Debugging Release Mode" on MSDN as I remember.
Iain.
|
|
|
|
|
Hello, i am fairly new to c++ (worked mainly with java 'til now) and i was wondering if anybody could help me with with a certain linker error i am getting, the error that tells me i have unresolved externals (lnk2001, lnk2019) specifically in "_WinMain" in "_CRTstartup@16" i think this has something to do with my WinMain method be a member function (it is static so there is no hidden "this" parameter) but don't don't know what else to do, is my WinMain declaration:
static int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
thanks to anyone who can help me.
|
|
|
|
|
Please consult the docs for compiler/linker errors! You need to create an entry point to wWinMainCRTStartup . Go to the Project Settings dialog box. Click the Link tab, and click Output in the Category box.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
The compiler is right, as is the previous replier.
The stub code from the compiler is trying to link to a WinMain function. You've provided a static
(well done!) function in a class, which is not actually called WinMain. Its name is CMyClass::WinMain.
Just to complicate things, due to overloading considerations it will actually be called
£$%^&CMyClass£$%^&WinMain£$%^&. The punctuation is my pretend name decoration.
So you need a class plain WinMain function. Feel free to have only one line of code in it which calls
your class's static WinMain function though.
Iain.
|
|
|
|
|
try #pragma comment( linker, "/ENTRY:WinMain" ), but the function mustn have any parameters!!
get the hinstance by GetModuleHandle, and the cmdline by GetCommandLine
Don't try it, just do it!
|
|
|
|
|
RegSetValueEx(SubKey3,"ValueName",0,REG_DWORD,?,?);
I know it's supposed to look kinda like this, but I can't figure out how to properly set those last two variables. I don't have any trouble with String values, but for some reason, I just can't seem to make DWORDs work for me.
halblonious
|
|
|
|
|
Straight from MSDN:
HKEY hk;
DWORD dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
RegSetValueEx(hk,
"TypesSupported",
0,
REG_DWORD,
(LPBYTE) &dwData,
sizeof(DWORD));
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Sweet! It works! It seems so simple now that you've told me. Hehe...I'm a dummy. Thanks a ton!
halblonious
|
|
|
|
|
When I start the VS.Net 2003, it shows the projects name and the
last modified date. However, the last modified date would not update
as I modified it. For example, I opened a project called "BlackJack"
on 10/1/03, and I have been working on it ever since. However, the
modified date still shows 10/1/03.
This problem only occurs in VS.Net version 2003. When I was using
VS.Net 2002, it was okay, and no this problem.
Anyony knows how to fix that?
|
|
|
|
|
Why wouldn'y anyone just answer me? I just want to know if that happened
to you too.
Thanks.
|
|
|
|