|
Borland IDE[^].
You see a man walking on the ice field, and that is the Windows desktop image. I am not telling you to use Borland tools as develop one, I am just talking about the IDE. You may develop your apps this way.
Maxwell Chen
|
|
|
|
|
Hi Maxwell,
Thanks for the idea!
Best,
Eric
|
|
|
|
|
I am trying to access a specific area of memory in another application and was wondering if anyone had any ideas on how to make that happen.
|
|
|
|
|
|
One possible way is to access it directly, all you need to know is the address in another process that you want access/modify:
1. If necessary enable SeDebugPrivelege for your process.
a. OpenProcessToken (..,TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY )
b.LookupPrivilegeValue
c. AdjustTokenPrivileges, CloseToken
2. OpenProcess with desired access (PROCESS_VM_READ .. )
3.ReadProcessMemory/WriteProcessMemory
HTH,
Edward
|
|
|
|
|
Hi everyone.
I have an existing MFC based GUI Windows application to which I would like to add functionality so it can also run as a Service.
I have good understand of how a Service works and I've written one from scratch but I'm stumped on how I can convert an existing MFC based GUI app to run as a Service. The problem is how to do all the required MFC initialization when the SCM calls my app.
My first thought was to implment the startup code myself and simply handle a command line arg to determine if I should run as a Service or not. I can then intercept the startup before InitInstance() is called and my GUI is displayed. Of course I would implement the required Service methods such as 'ServiceMain' and 'ServiceControlHandler' then based on the command line arg I would hand of startup control to these methods and away I go to running a Service.
Then I looked at how much MFC is doing before it calls InitInstance() on my app and realized writing my own 'WinMain' isn't going to be trivial.
So basically I'm looking for advice on how to handle this. I could just write a standalone Service based on this app but I would love to just have one module which is dual purpose.
In writing this I just had a thought. Shouldn't I just determine if I'm running as a service or not in InitInstance() and go from there? Maybe that's the solution but I've typed this all out so I might as well post it.
|
|
|
|
|
although I may not be perfect but I think services are background processes that run in the background without any user intervention.
I developed a service which was a router. As you can understand routers are suitable for these kind fo applicaton (service) who once need to be configured and then they play their role quitely in the background i.e. routing.
Well, to configure that router, I made another MFC GUI application. This application is launched from a user (normally System Administrator) to configure the router. Administrator configures the router by using this GUI tool and the closes it and once again router starts its work according to new settings.
I dont think of any GUI application as a candidate to be a service. I dont even see any windows service implemented in this way.
Think on your application whether it is a candidate to become a service!!!
|
|
|
|
|
Thanks for the tip hashimsaleem.
Well as I said at the end of my post I figured out what I needed to do by the time I finished posting my question. Basically I wrote all the Service functionality and just made my app run as Service or instantiate the Dialog (or main window) depending on how it was started. It was pretty simple.
|
|
|
|
|
I am trying to use easy_odbc. I have copied the .h and .cpp files into my project directory and added them to the MS C++ project as source and header files.
When I compile I get the following message
Compiling...
easy_odbc.cpp
c:\program files\c technologies\c-pen sdk\cwin\samples\tutorial_1_vc\easy_odbc.cpp(306) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.
Does anyone have any ideas?
Thanks
Glen
|
|
|
|
|
In Project > Settings, select the files for easy_odbc in the tree, go to the C++ tab, the Precompiled Headers category, and choose the 'Not using precompiled headers' radio button.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks for the advice. I tried it straigth away and here is the result
Compiling...
easy_odbc.cpp
Linking...
CWinAPITutorial1Dlg.obj : error LNK2001: unresolved external symbol _SQLFreeEnv@4
CWinAPITutorial1Dlg.obj : error LNK2001: unresolved external symbol _SQLFreeConnect@4
CWinAPITutorial1Dlg.obj : error LNK2001: unresolved external symbol _SQLDisconnect@4
CWinAPITutorial1Dlg.obj : error LNK2001: unresolved external symbol _SQLFreeStmt@8
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLFreeStmt@8
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLAllocStmt@8
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLConnect@28
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLAllocConnect@8
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLAllocEnv@4
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLRowCount@8
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLExecute@4
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLPrepare@12
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLExecDirect@12
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLSetStmtAttr@16
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLEndTran@12
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLGetDiagRec@32
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLDescribeCol@36
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLNumResultCols@8
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLFetchScroll@12
easy_odbc.obj : error LNK2001: unresolved external symbol _SQLBindCol@24
Debug/CWinAPITutorial1.exe : fatal error LNK1120: 19 unresolved externals
Error executing link.exe.
Can anyone give me some additional advice on solving these link errors?
Thanks
Glen
|
|
|
|
|
I was able to resolve this issue by adding the following the object/library modules in the link/general tab of my project settings
Thanks for all the assistance
Glen
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
|
|
|
|
|
I was going to say, add odbc32.lib to your link settings. Adding all the others are unlikely to do any harm, but will increase your build time slightly.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
can you overload the same operator? For example:
<br />
void operator = (char* arg_cDate);<br />
void operator = (CDate arg_cdDate);<br />
|
|
|
|
|
i think as Unary and binary. not in the same
More n' More
|
|
|
|
|
of course you can, but only in C++
But what is troubling in your code lines, is that you overload an "=" operator, but it doesn't return anything, so, if the parameter is the value you want to assign to another, where is the destination ??
Are these operator inside classes definitions?
is this better ?
<font style="color:blue;">void operator</font> = (<font style="color:blue;">void</font>* DestObject, <font style="color:blue;">char</font>* arg_cDate); <font style="color:green;">
<font style="color:blue;">CDate& CDate::operator</font> = (CDate arg_cdDate); <font style="color:green;">
for the last one, i would even prefered that synopsis :
<font style="color:blue;">CDate& CDate::operator</font> = (<font style="color:blue;">const</font> CDate& refDate); <font style="color:green;">
what do you think about this ?
TOXCCT >>> GEII power
|
|
|
|
|
You're right, I am so n000b (thanks!! )
|
|
|
|
|
what am i doing wrong?
i open a file in a function and i can't see it in main. thanks for your help!
<br />
int main (void)<br />
{<br />
FILE *archc=NULL;<br />
<br />
load (archc);<br />
<br />
<br />
fprintf (archc,"hello");
fclose(archc);
<br />
return 0;<br />
}<br />
<br />
void load (FILE *archc)<br />
{<br />
archc = fopen("simple.c","r+")<br />
}<br />
|
|
|
|
|
Try this
int main (void)
{
FILE *archc=NULL;
load (archc);
fprintf (archc,"hello"); //can't write
fclose(archc); //can't close as well
return 0;
}
void load (FILE *&archc)
{
archc = fopen("simple.c","r+")
}
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
|
You must pass the address of the FILE pointer variable.
instead of that you passed the pointer variable value.
More n' More
|
|
|
|
|
don't forget to type if the fopen() really opened your file by testing its return value.
TOXCCT >>> GEII power
|
|
|
|
|
One possibility,
int main (void)
{
FILE *archc=load ();
if ( archc )
{
...
}
return 0;
}
FILE * load ()
{
return fopen("simple.c","r+") ;
}
But if you don't have to use C consider looking at IOStreams in the C++ Standard Library.
Paul
|
|
|
|
|
Both recv() and WSARecv() block if the data is not available. What can I do to make them non-blocking? I just want to get the data from the server if it is available, otherwise, go on to something else.
I've never used sockets before so the answer is probably obvious.
Thanks,
DC
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
wow david i am suprised... first question ever from you.
Any ways i had a similar problem... so i wrote my own read function that would spawn a thread... in the thread i would recv...
and in myread function i would wait till timeout..
if the thread timedout i assume that the recv has blocked otherwize i have the data.
I dont konw how efficient it is or wheather there exits a better alternative, but its working as of now.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|