|
Hi
Quick question:
Can one OR (||) compiler directives, such as:
IFDEF ( xxxx || yyyy )
ENDIF
Thanks
Rui
|
|
|
|
|
Use '#if' and 'defined':
#if defined(XXX) || defined (YYY)
...
#endif
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Hey,
I have written an executable to capture mouse/keyboard events and play these back after. The function basically writes the message data to a text file, and reads it back in for playback.
I now need to put this into a COM DLL so that I can call it from a VBScript to get a playback.
The problem i have is with the ::SetWindowsHookEx function. I call it as follows
g_hHoohPlayBack = SetWindowsHookEx(WH_JOURNALPLAYBACK, JournalPlaybackFunc, LoadLibrary((LPCTSTR) "TRShell"), 0);
and in the callback JournalPlaybackFunc function, i use this to recreate the mouse/keyboard event
PostMessage(HWND_BROADCAST, WM_SERVICE_INFO, SI_S_PB_WAIT, lReturnValue);
It seems to be going into the callback function ok, but there is a problem with the Postmessage parameters. This code worked fine for the executable, but not when i use it in a dll and call from VB. Nothing happens.
Thanks for any help
tony
|
|
|
|
|
hello,
I have made a program in C++ , now i want to add the functions and structures to my an VC++ 6.0 MFC application . i have made a header file (-->"wioctl.h") and added all the functionality and structures in it.
Now when i include this file in more than one file including Application.cpp , it gives a linking error for all the functions and structurs -->> function <myfunction> already defined in Application.obj
|
|
|
|
|
You shouldn't add function definitions in .h, only functions declarations (prototypes) and structure types. Split wioctl.h into wioctl.h and wioctl.cpp.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Tomasz Sowinski wrote:
You shouldn't add function definitions in .h, only functions declarations (prototypes) and structure types.
...Or you must use inline functions
|
|
|
|
|
... or static functions or ones defined in anonymous namespace.
The question is, should the still be in .h file? Without actual functions, nobody is able to answer this
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Perhaps use this in your header file:
#if !defined(MYHEADERFILE_H)
#define MYHEADERFILE_H
#endif
Because this header is used by other files, it could be redefine...
Hello World!!!
from Raphaël
|
|
|
|
|
hi,
I have an SDI application. I have a splitter with left and rigth view . I have added a list in left view.
Now i want that whenever any of the nodes in left view is clicked, the view in the right change and show some data, if other is clicked some other data is shown And every right view should retain its data .
how can i do it ??
thnx,
|
|
|
|
|
Handle LVN_ITEMCHANGED in left view and change the right view accordingly. What kind of window is the right view?
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
You might notify your CDocument about view changing and then inform all views by means of UpdateAllViews (see MSDN). Create some flags in CYourDocument, which describe document state at that moment, when you update views. Each view will look at this flags and will decide whether must it make update of itself or not. Or you can manage updating of views from CYourDocument class and decide here which view needs update.
Also you may find specified view by means of GetFirstViewPosition/GetNextView but I do not recommend to link views directly. It is better to use technique described above.
|
|
|
|
|
friends,
i wrote an application to download the files from an FTP server by using the CFtpConnection,CInternetSession and CFtpFileFind...
my application will check the ftp server in a time interval,and if there is any files then simply download them..i used this program to collect files in which other users upload to that ftp server
i used the GetFile() method to download the file...but my problem is that...if there is any files they are not completley Transfered(transfering in progress),they are also downloads.ie i get some incomplete /damaged files
Is there is any way to identify the Files in which they are in the Status of Transfering(copying to server),ie not completely uploaded to the server....
hav any idea..??
A Programmer Never Dies..***
|
|
|
|
|
In the release build, _DEBUG isn't defined. #ifndef _DEBUG evaluates to true at compile time and code is included.
ns wrote:
Or is there something like _RUN or something that makes code run at runtime thats within #ifdef _RUN execute?
I don't know what do you mean by this.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
I have 10 items in the listbox.when i scroll the vertical scroll bar downwards,say some three items gone up.So the first three items is not visible to user.How to programmatically find out that the first three items is not visible.
|
|
|
|
|
GetTopIndex() will tell you which is the top visible item. After that, it's not rocket science to figure it out.
Steve S
[This signature space available for rent]
|
|
|
|
|
Just for the rocket scientists out there;P
If you know the height of one item (htItem), (LB_GETITEMHEIGHT) and you know the client height of the list (htClient), you can, by dividing htClient by htItem, determine the number of visible items.
If you then know the top index, you can also work out the bottom index.
To make items become visible programmatically, you can scroll the list by calling SetTopIndex (in MFC, message is LB_SETTOPINDEX) appropriately.
If you resize the list box, you have to recalculate, of course
Steve S
[This signature space available for rent]
|
|
|
|
|
I'm migrating from VC++ 6.0 to VS.net. I created dialog resources, but don't know how to create a CDialog derived dialog for it the dialog resource.
|
|
|
|
|
Open popup menu above dialog resource and choose "Add Class".
|
|
|
|
|
I don't see "Add Class". I only see "Add Class" when I selected the project name, but it just show me a normal Class add dialog without the way to specific the Dialog template resource.
When i right click in the dialog resource, I see
Cut
Copy
Paste
Delete
--------
Resource Includes
Resource Symbols
--------
Open
Open Binary Data
--------
Save Myproject.rc
Add Resource...
Insert Copy
Insert Dialog
Export
|
|
|
|
|
There is no anything surprising because you click in resource tree window although the right way is to click on dialog itself
|
|
|
|
|
Thanks very much. I got it. No matter why I coudln't find it coz i was puzzling with the resource tree. haha ...
|
|
|
|
|
Hello world.
Can anybody tell me what's the difference between those MACRO in MFC:
ASSERT( booleanExpression )
and:
VERIFY( booleanExpression )
I know what they mean but I don't see any difference...
Thanks in advance...
Hello World!!!
from Raphaël
|
|
|
|
|
Unless AdamUK beats me to it again...
ASSERT disappears in a release build, while VERIFY doesn't.
For example,
ASSERT( ( p = somefunction() ) != 0)
VERIFY( ( p = somefunction() ) != 0)
In the first case, the code is =eliminated= and will more than likely cause some hapless (or should that be witless) developer to tear out their hair trying to figure what's gone wrong. In the second case, the code is retained, but no test is actually performed.
At least, that's how they used to work...
Steve S
[This signature space available for rent]
|
|
|
|
|
check out this link for more info:
http://gamedev.net/reference/articles/article1846.asp
|
|
|
|
|
if (remaining & pAccess->dwValue)
{
remaining &= ~pAccess->dwValue;
}
remaining is a typedef DWORD structure and pAccess is a structure and dwValue is DWORD type.
What does one & mean?And what does its next line means?:remaining &= ~pAccess->dwValue;
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|