|
Put "stastic" before the definition of the variable.
or
move the definition to the cpp file( say in definitions.cpp ) and declare it in the header file.
in cpp file
unsigned char * Rec_Buffer;
in header file
extern unsigned char * Rec_Buffer;
nave
|
|
|
|
|
Add #pragma once as the first statement in your Definitons.h
cheers...Milton KB
|
|
|
|
|
Milton KB wrote: Add #pragma once
no use
nave
|
|
|
|
|
i am trying to write a script. i need to copy the contents of my clipboard into a text file. then i need to save the text file as a htm file extention with a different name then i need to close both of the files. basically what i am doing is saving web page code in a filemaker pro data base. and i want to take the contents of a field that contains my code. and save itr as a htm file. is there any scripting language that will allow me to do this.
thanks in advance for any responses
-- modified at 22:59 Monday 31st July, 2006
|
|
|
|
|
|
Hey all,
I use VC++6.0 version and have created a single document application.
When I try to close my application by using the exit control button im dialog page, I get this error message:
" Unhandled Exception in Prog.exe (KERNEL32.DLL):0xC0000005:Access Vioaltion.
I dont know how to fix this error. Can anyone help me with this. Waht does this mean and how do fix it?
Thanks in advance.
|
|
|
|
|
An access violation means your program is touching some memory that it should not. Perhaps you are attempting to use an object that has been deleted etc?
Best thing to do is to set the debugger to break when this type of exception is raised. In the debug menu choose exceptions (I think thats what its called, I cant remeber the exact name of the commands in VC6) and find the access violation and set it to break when exception raised / thrown. Then rerun your program and see where this exception is coming from.
Objects in mirror are closer than they appear
|
|
|
|
|
Other then MessageBox() is there any other function to display in vc++.
Is there any function which will print the data coming form server in ther list box.
ANY LINK.
ANY IDEA.
|
|
|
|
|
OutputDebugString(..) may be use full.
nave
|
|
|
|
|
But it works only when the coding is in Debug Version
never say die
|
|
|
|
|
|
I m using it right from the day i started coding .Right i m using it
-- modified at 10:50 Tuesday 1st August, 2006
never say die
|
|
|
|
|
Then whu did u ask like this
"But it works only when the coding is in Debug Version"...?
nave
|
|
|
|
|
Hello,
I'm looking for a library, that is able convert a regular expression to a c/c++ source code, which will parse an input string.
Anyone heard of such a library?
Regards,
Alex
Don't try it, just do it!
|
|
|
|
|
You might try investigating one of the parser generators out there to see if they can be configured to do the job. There is VisualParse (expensive commercial product) and some free ones at ‘sourceforge.net’. If it is an option, I would be tempted to use Regex++ to do the parsing, but I think you know about that already.
Note: I have added this to my to-do list, as an expansion of my personal RE parser.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
hi,
i met a dreadful problem with my program
i decleared and defined an external variables in one .c file like this:
//File 1.c
int a=0;
...
main()
{}
...
and then i wanna use a as an external variable in one .cpp file where i defined a class ABC like this:
//file 2.cpp
extern int a;
....
Class ABC::MemberFunction()
{
int tmp=a;
}
the program passed compiling but not linking
the error message says: error LNK2001: unresolved external symbol "int a" (?a@@3HA)..
what happened??
i also tried to declare "a" as:
extern "C" int a;
but still doesn't work.
what's more, my boss started pushing me on the program
|
|
|
|
|
In file2.cpp, you want your extern to look like this:
extern "C" { extern int a ; }
This tells the compiler the variable lives in a C module.
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2.3 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
|
i have a program like this:
main app is CMyApp ::CWinApp
i give an ID for a button on the main window:
ID_MY_BUTTON
i want to handle the click message in CWinApp's member function
so i mapped the message as:
ON_COMMAND(ID_MY_BUTTON, OnMyButton);
and write the code for the function
actually it works very well
but the question comes up when i tried this:
::postmessage(hMainWnd, ID_MY_BUTTON,Null,Null)
i used hMainWnd because i believe the message mapping net can automatically send the message to the main thread.
but, finally, i found this does not cause the OnMyButton to be called.
i also tried this one:
::PostMessage(hMainWnd, WM_COMMAND, ID_MY_BUTTON, 0)
but it still doesn't work
so, how should i send this ID_MY_BUTTON message so that the main thread can handle it?
thanks alot!
-- modified at 18:11 Monday 31st July, 2006
|
|
|
|
|
I think generally its a bad idea to mix the mfc message handling stuff with the win32 functions. It should all work ok but your program will be easier to maintain if you pick one and stick with it.
You need to send the message to the parent window of the button. Off the top of my head you should try something like
MyButton->GetParent()->SendMessage(...);
Objects in mirror are closer than they appear
|
|
|
|
|
|
Hi,
Having some trouble getting a char* from the Stupinfo.hStdOutput which is a HANDLE.
STARTUPINFO Stupinfo; PROCESS_INFORMATION ProcessInfo;
char* procnm="Test.exe";
HANDLE h;
LPWSTR lpwString = L"";
lpwString = (LPWSTR)procnm;
IntPtr StdOutput;
Stupinfo.dwX=0;
Stupinfo.dwY=0;
Stupinfo.hStdOutput=h;
CreateProcess(NULL, lpwString, NULL, NULL, FALSE, 0, NULL, NULL, &Stupinfo, &ProcessInfo);
char* tesst="test";
tesst=Stupinfo.hStdOutput;
send(AcceptSocket, tesst, strlen(tesst), 0);
I know its not going to be easy unless there is simple convesion. but ive seen methods which output to .txt file for some reason.. but i dont see why you couldn't get the char*
Please Help
-- modified at 17:31 Monday 31st July, 2006
|
|
|
|
|
You have to create a HANDLE *before* calling CreateProcess. Usually people use CreatePipe, but you can also pass socket handles as well. Then you ReadFile/WriteFile to the handle to read/write data.
|
|
|
|
|
Could you please show me some code?
STARTUPINFO Stupinfo; PROCESS_INFORMATION ProcessInfo;
char* procnm="Test.exe"; char* tesst; BOOL readIntoMemory;
HANDLE h, hWritePipe; LPSECURITY_ATTRIBUTES lpPipeAttributes; DWORD nSize;
LPWSTR lpwString = L"";
lpwString = (LPWSTR)procnm; LPVOID inBuffer; DWORD nBytesToRead; LPDWORD nBytesRead, lpNumberOfBytesWritten;
DWORD bytestowrite;
IntPtr StdOutput;
Stupinfo.dwX=0;
Stupinfo.dwY=0;
Stupinfo.hStdOutput=h;
CreateProcess(NULL, lpwString, NULL, NULL, FALSE, 0, NULL, NULL, &Stupinfo, &ProcessInfo);
ReadFile( h, inBuffer, nBytesToRead, nBytesRead, NULL);
WriteFile( (HANDLE)AcceptSocket, inBuffer, bytestowrite, lpNumberOfBytesWritten, NULL);
how to use the WriteFile to get a char*?? and do i have it setup correctly?
-- modified at 19:25 Monday 31st July, 2006
|
|
|
|
|
Hi!
We have a class CDriver which inherits from IDriver. CDriver is defined in a library, CDriver.lib. CDriver.lib is added to the library definition of the project settings, and we have CDriver.h included in the file list for the project.
If we create a new class, CMyDriver, which inherits from CDriver, and add member variables to it, when we run the app, things crash when the destructor is called. If we remove the member variables things work properly. We can add as many member functions as we want, but cannot add member variables.
We dont understand that's happening. Any ideas? This is basic inheritance!! This is weird that I cannot add member variables.
Help!?!?!?
-C
|
|
|
|