|
You need to compile the lib in to a dll, then you can pinvoke it. I don't believe you can use code from a lib file in C#, as a lib file is linked against, and you can't link C++ code into a C# app, all you can do is call a C++ dll from C#.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The small possibility exists that you use VS2005. In that case you might be able to produce a mixed assembly[^].
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi all,
I am building an AUTO-RUN project which have application install, directx install and device driver install. After directx has been installed completely the system must be rebooted, in this case how can i follow the driver install procedure?
Are there any API can do that in VC++ ?
Thanks for any suggestion or help.
|
|
|
|
|
Search the registry for runonce. This key is where you put the path to the app you want to run. There's no API to call, because your program will stop when you reboot.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
create a log file in a particular directory.. update it whenever a successful installation has been done.. mark it up with some checkpoints.. continue from there..
Eg:
Log File:
1.. (Application install done..)
2.. (DirectX done..)
so ur log file will have 2 at the End.. so u should start from 3 ->(Driver Install)..
am i right?
Regards,
V
|
|
|
|
|
I found that most of the example are multithread program, I still cannot find a example program abuot server and single client. can somebody give me some example? It really helpful for me.
|
|
|
|
|
|
|
i have no idea that hw to shut down certain pc automatically whn that computer priority shown emergency which is 0. we need to knw which ip address is shown the priority 0 and shut down it whn the priority 0 is more than 10 times!
can u all gv me an example hw this work?? thanks!
|
|
|
|
|
bryan523 wrote:
i have no idea that hw to shut down certain pc automatically whn that computer priority shown emergency which is 0
Can you clarify what you mean with "computer priority shown emergency"?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
actually server have priority 0 to 7 whc catagories the level of access by unauthorizes person and save it at syslog txt file! As below:
Numerical Severity<br />
Code<br />
<br />
0 Emergency : system is unusable<br />
1 Alert : action must be taken immediately<br />
2 Critical : critical conditions<br />
3 Error : error conditions<br />
4 Warning : warning conditions<br />
5 Notice : normal but significant condition<br />
6 Informational: informational messages<br />
7 Debug : debug-level messages
the syslog txt file contain priority and ip address as below:
<133>Jul 26 10:32:48 sensor SFIMS: [1:499:4] ICMP Large ICMP Packet [Classification: Potentially Bad Traffic] [Priority: 2] {ICMP} 192.168.2.25 -> 202.76.239.1
I need urs help that hw to automatically shut down the certain pc by knowing the ip address when the priority 0(emergency) is more than lets say 100 times!
-- modified at 2:37 Friday 2nd September, 2005
|
|
|
|
|
I'm trying to call the SystemParametersInfo() function in User32.dll from my C/C++ code on Win2k but it's not working. I've used the same code to successfully call a function from a different dll (kernel32.dll) so I'm confused. The LoadLibrary command works, but the GetProcAddress command is not, thus I get the output:
started it up...
loaded library...trying to find address of function...
proc addr: 0
couldn't get proc addr
I'm compiling with Visual Studio.net 2003. Any suggestions would be greatly appreciated. Thanks.
<br />
<br />
<br />
<br />
#include <stdio.h><br />
#include <windows.h><br />
<br />
#define _WIN32_WINNT 0x0500<br />
<br />
typedef BOOL (*MYPROC) (UINT, UINT, PVOID, UINT);<br />
HINSTANCE hinstLib; <br />
MYPROC ProcAdd; <br />
<br />
BOOL result;
UINT uiAction;
UINT uiParam;
PVOID pvParam;
UINT fWinIni;
<br />
int main()<br />
{<br />
printf("started it up...\n");<br />
hinstLib = LoadLibrary("User32.dll");<br />
<br />
if (hinstLib != NULL) <br />
{ <br />
printf("loaded library...trying to find address of function...\n");<br />
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "SystemParametersInfo"); <br />
printf("proc addr: %d\n", ProcAdd);<br />
if (!ProcAdd) <br />
{<br />
printf("couldn't get proc addr\n");<br />
FreeLibrary(hinstLib);<br />
return 1;<br />
}<br />
printf("got proc addr...calling function\n");<br />
result = (ProcAdd) (uiAction, uiParam, pvParam, fWinIni); <br />
} <br />
else <br />
{<br />
printf("Failed to load lib\n");<br />
}<br />
<br />
FreeLibrary(hinstLib);<br />
printf("freed lib\n");<br />
return 0;<br />
}<br />
|
|
|
|
|
|
Thanks! "SystemParametersInfoA" worked! I never would have gotten that without your help.
|
|
|
|
|
|
how to define a const multileline string as
const string TEMPLATE = "HELLO!
IF YOU CAN HELP ME ,
I WILL THANK YOU VERY MUCH";
this can not pass complie
I love Programming
|
|
|
|
|
const string TEMPLATE = "HELLO!\nIF YOU CAN HELP ME ,\nI WILL THANK YOU VERY MUCH";
|
|
|
|
|
sorry , i don't want the "\n", because it not readable
if there is a solution that present multile line is very good!
I love Programming
|
|
|
|
|
I'm afraid you are not in a position to write the language yourself, you have to live with the language as it exists. Best you can do is this:
#define NEWLINE \r\n
and then use NEWLINE, or something similar.
In any case, \n won't work, it's \r\n ( or \n\r, I forget ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
the solution as:
const string TEMPLATE =
"HELLO! \n\
IF YOU CAN HELP ME ,\n\
I WILL THANK YOU VERY MUCH!";
I love Programming
|
|
|
|
|
Do you want it to be multiline only in your source code
const string TEMPLATE = "These three string literals will be "
"concatenated and the result assigned "
"to TEMPLATE as a single string";
or do you want it to contain multiple lines
const string TEMPLATE = "These are the first,\r\nsecond,\r\nand third lines";
or both?
const string TEMPLATE = "These are the first,\r\n"
"second,\r\n"
"and third lines";
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
very good! what i need is the third solution , both the source code in multiline and the output! thank you! thanks all!
I love Programming
|
|
|
|
|
I want to create a CEdit as a child window of a CListCtrl when CListCtrl is si created and destroy it when CListCtrl is destroyed.
I declare a member var in CListCtrl like this, CEdit m_edit,
and use m_edit.Create(...) in CListCtrl's constructor or CListCtrl's OnCreate,
but it doesn't work, the m_edit.m_hWnd is 0.
|
|
|
|
|
It won't work in the list control constructor because you need to pass the list's hWnd to m_edit.Create and hWnd will be null at that point.
I think it should work in the list's OnCreate, though. Post some code to see how you are doing it...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|