|
MSDE is a cut down version of SQL Server. It is a database in its own right where MDAC is the DLL's and files needed to talk to the various databases.
You'll probably need to install MDAC onto your clients machines. If you want to use MSDE as your database you'll need to install that too. MSDE is a nice database system, much better than Access.
Michael
Communication is the first step towards enlightenment.
|
|
|
|
|
Thanks for clarifying, Michael! I've got a clearer idea of how to start
|
|
|
|
|
can anyone give me an example of how to use the hidecaret() funtion in a simple text program?
thx,
-ryan
|
|
|
|
|
If it's CWnd object, simply call the HideCaret() function. If this is a dialog box, you'll have to call it individually for each edit box, means you'll need to sub class them. Moreoever I am talking theory here without having actually tested it. So beware
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
When you say "a simple text program" I take it that you mean a program having a main(), and in that case you have no business messing about with the GUI.
Specifically, there is no documented way to get the HEND of the console window you are running inside (since you might actually not be running inside a window).
|
|
|
|
|
Is this safe :-
(CONST BYTE*)(LPCTSTR)m_str
I am casting a CString to a CONST BYTE* for use with RegSetValueEx(...)
Nish
p.s. It's working fine now! But I just wanted to make sure, it's okay.
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
Hi Nish. Rest assured, this is perfectly safe (as long as you don't let this pointer live its own life and use it only on calls like the one you're dealing with, but you already know that.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks Joaquin,
That's what I wanted. Solid assurance. And I got it from you
A for you. Now that makes it 5 total I guess
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
Nish,
Note that to cast a CString to a (CONST BYTE *) is a safe in this case. Since RegSetValueEx method is looking for a (const BYTE *) and is just going to write the data a byte at a time to the registry, this works.
BUT, this would not be true if a function wanting a (CONST BYTE *) was going to look at it as a BYTE array of text characters. If compiling for a UNICODE release CString characters are 16 bit instead of 8 bit. Remember a BYTE is 8 bit for non-UNICODE and UNICODE both. So this could be a problem in other situations.
Also, note that your cast above would NOT work if you complied for UNICODE and told the RegSetValueEx method that the length of your data was CString::GetLength(). It would return the number of text characters not the number of bytes.
In cases where you want complete compatibility, use the MFC and ATL string conversion macros. See the MSDN article String Conversion Macros.
void CMyClass::HandleString(LPCTSTR szPath)
{
if(szPath != NULL)
{
USES_CONVERSION;
char *s = T2A((LPTSTR)szPath);
...
}
} Nish, I'm sure you already know this, I mainly posted this for any new programmers who might need help with casting.
Hack on...
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Thanks for the tips, Jonathan. I was actually using GetLength() and had overlooked the problems that would occur for a UNICODE build.
Regards
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
I have a Windows Development course project and my part of the project is to create the event logging module that uses the Windows Event Viewer. I have referenced Windows NT Event Logging By James D. Murray and Programming Server-Side Applications for Microsoft® Windows® 2000 by Jeffrey Richter, Jason D. Clark. These were a big help, but I can't seem to get Event viewer to link to my message DLL. Event Viewer has the logs I create, but when I double click on the event to look at the properties the following message is displayed.
The description for Event ID ( 100 ) in Source ( Logger ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event: dfgdfhfd, dfhfdhdsfhdsfh.
"dfgdfhfd, dfhfdhdsfhdsfh" are the two test strings that I passed into the event log that are supposed to be use with the message DLL to produce "Username: dfgdfhfd, Password:dfhfdhdsfhdsfh" in the Description. I have checked the path I set in the registry for the message DLL and it is correct. Does anyone have any insight into what I'm missing?
Nate
You can kill the revolutionary, but you can't kill the Revolution. (RATM & TOOL)
|
|
|
|
|
You have created the message files and compiled them with the "message compiler" (mc.exe)?
You are _really_ sure your DLL containing these messages is in the registry:
HKLM\System\Current...\Serives\Eventlog\Applications\MyFooApp
and that there is a REG_SZ or REG_EXPAND_SZ entry with the name EventMessageFile pointing to your message DLL?
If you are really, really sure this is OK, I think you have to elaborate.
|
|
|
|
|
First off,Thanks for the response---I appreciate any help you can offer.
I was going to post my code with my question, but I'm new to this board and didn't see an attachment box anywhere. Is it possible to upload small attachments?
I have compiled the message file using the MC.exe with several different parameters(every source I have found uses slightly different parameter). I then use RC.exe to create the .res file. I then use link.exe to create the DLL from the .res file. I'm not sure any of this is completely correct.
I use a CRegKey object(m_RegistryKey) in a wrapper class I wrote and call my member function below. I have tried #define MY_LOGGER_REG_PATH "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\Logger" and I still get the same description, Logger is just stored under Application instead of EventLog.
#define MY_LOGGER_REG_PATH "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Logger"
void LogRegisterMod::CreateRegKey()
{
// prevents re-creation of registry key if it already exists
// if(this->m_RegistryKey.Open(HKEY_LOCAL_MACHINE,MY_LOGGER_REG_PATH) != ERROR_SUCCESS)
{
// creates or opens(if key already exists) the registry key
this->m_RegistryKey.Create(HKEY_LOCAL_MACHINE, MY_LOGGER_REG_PATH);
// sets the type of event the log supports
this->m_RegistryKey.SetValue(EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE | EVENTLOG_ERROR_TYPE,"TypesSupported");
// sets the HD path to find the event message DLL/EXE
this->m_RegistryKey.SetValue("C:\\Data\\CodeRock\\CS499\\Logger\\LoggerMessage.dll","EventMessageFile");
// sets the number of catergories in the message DLL/EXE
this->m_RegistryKey.SetValue(1,"CategoryCount");
// closes the registry key
this->m_RegistryKey.Close();
}
}
This is my message file.
;/*********************************************************************
; Module Name: LoggerMessage.mc
; This will produce the Message DLL to be associated with the Logger event logging
;/*********************************************************************
;//*********************Catergory Section********************************
;// Catergory ID are 16-bit values
MessageIdTypedef=WORD
MessageId=1
Severity=Success
Facility=Application
SymbolicName=MSG_TEST
Language=English
Test
.
;//**********************Message Section********************************
;// Event ID's are 32-bit values
MessageIdTypedef=DWORD
MessageId=100
Severity=Informational
Facility=Application
SymbolicName=MSG_USERNAME
Language=English
Username:%1, Password %2
.
;//*************************End of File********************************
You can kill the revolutionary, but you can't kill the Revolution. (RATM & TOOL)
|
|
|
|
|
niverson wrote:
I have tried #define MY_LOGGER_REG_PATH "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\Logger" and I still get the same description
That is however how it's intended to be used. You should usually not add any keys to the Eventlog key (since that in fact is creating a new event log!), only its three existing subkeys.
What might be a problem for you, is that according to documentatin the EventMessageFile value must be of type REG_EXPAND_SZ. From your code it seems you're using a plain REG_SZ. This probably isn't a problem in your case since you're using hard-coded paths, but when given the choice to do it "right".
Another thing to look out for is that (again if my memory serves me) is that you need to add the value ParameterMessageFile (also REG_EXPAND_SZ) for event messages with replacement values. I think this is your current problem.
|
|
|
|
|
I have looked at the REG_EXPAND_SZ parameter before and that is used to expand %SystemRoot% to the local machines Root path. I think I have to find an API function to declare REG_EXPAND_SZ because the MFC function specifies REG_SZ automatically.
There are three message files that can be specified: ParameterMessageFile, CatergoryMessageFile, and EventMessageFile. I have added all three and pointed then to the same DLL. According to the books, the DLL can contain all three types in one file. My current DLL only has catergories and events. It gave me the same error message. I have looked at other event log registry values and some have all three specified, some have Category and Event, others have only event. I will try this again. The books say how important Logging is, but I haven't found a good example of source code that implements logging yet. As important as Logging is, VS 6.0 doesn't have a Message compiler integrated. Logging looks like it was added as an afterthought.
Nate
You can kill the revolutionary, but you can't kill the Revolution. (RATM & TOOL)
|
|
|
|
|
I'm trying to get the strings of my CMenu, but it returns an error, why is this?
|
|
|
|
|
|
Can anybody help me out here please,
By default CRecordset Creates a RFX_Date in it's header. This Only supports CTime. How Can I save My COleDateTime to Access without converting to CTime(I don't know why CTime was ever created). I read an artical a while ago About this but I can't seem to find it again.
Hey if nobody knows, Well Somebody will know sometime!!!
|
|
|
|
|
Suppose I code such a very simple code:
void main()
{
printf("main is at 0x%p\n", main);
}
I get a result:
main is at 0x0040100F
But if I hover the cursor on the variable main while debugging, VC++ tells me, the address of main at 0x00401030.
So how can I printf the actual address of main (0x00401030) ??
Here's the assembly code:
@ILT+10(_main):
0040100F E9 1C 00 00 00 jmp main (00401030)
5: void main()
6: {
00401030 55 push ebp
00401031 8B EC mov ebp,esp
00401033 83 EC 48 sub esp,48h
00401036 53 push ebx
00401037 56 push esi
00401038 57 push edi
00401039 8D 7D B8 lea edi,[ebp-48h]
0040103C B9 12 00 00 00 mov ecx,12h
00401041 B8 CC CC CC CC mov eax,0CCCCCCCCh
00401046 F3 AB rep stos dword ptr [edi]
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
When you run in debugger mode, some of the breakpoint code is also inserted and thus main() gets displaced.
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
Yes, but I was printing the address while in debugging mode,
it should still have printed the address that maps to the machine code, but it did not!
Please take a look at the assembly and machine code at the end of the original message again. The output told me the address of
@ILT+10(_main)
but not the address of
5: void main()<br>6: {<br>00401030 55
That's what I am curious about.
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
In an ATL COM Server,how can I load a conventional DLL?
|
|
|
|
|
Hi,
If I understand you correct, do you want to load a DLL at runtime? If so the look at the 'LoadLibrary' API for non MFC projects and AfxLoadLibrary for MFC projects....
else if at compile time then use the static library *.lib and the required header file
|
|
|
|
|
I have an MFC Extension DLL implemented in my program. It is a simple modless dialog. Everything works fine in Debug but when I go to release and run it I get an Assertion right when I try to set a variable in the DLL class from the calling app.
I can post some code it need be, but has anyone seen this. And if so, what are some of the ways that you have fixed it.
Thanks in advance
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
Sorry all. I figured it out. I copied the wrong dll.
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|