|
Hi
I had a line like this:
<br />
#if defined _CIP || (_STANDALONE && (_KA || _UDV)) || _OTN9<br />
<include something><br />
#endif<br />
One of these defines are no longer needed so I changed it into:
<br />
#if defined (_STANDALONE && (_KA || _UDV)) || _OTN9<br />
<include something><br />
#endif<br />
But this gives a warning / error
aaa.cpp(288) : warning C4004: incorrect construction after 'defined'
aaa.cpp(288) : fatal error C1012: unmatched parenthesis : missing '('
But I'm beginning to suspect it should have been
<br />
#if (defined _STANDALONE && (defined _KA || defined _UDV)) || defined _OTN9<br />
instead
This gives no compiler warnings / errors
What I want is to include some lines if one of the following combination are true
_STANDALONE && _KA
_STANDALONE && _UDV
_OTN9
Would this changes how things would be handled in the preprocessor stage ?
Remark:
I don't use #define to define these, but using "preproccesor settings" under "project settings" , that is the /D switch
Using VC6
|
|
|
|
|
to_be_unknown wrote:
#if (defined _STANDALONE && (defined _KA || defined _UDV)) || defined _OTN9
This is the correct syntax, and will work as you require. The original syntax that you used would work, but only if the defines had the value 0 or 1, or if they were not defined (the preprocessor assumes a definition to have the value 0 if it is not defined). If they had any other value, it would not work correctly.
The reason you were getting compiler errors was because the defined operator operates on an identifier, not on an expression.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks
It would mean I'm going to change alot of like this in my program.
Relying on the preprocessor to assign 0 to not-defined defines could be dangerous. Unless it is specified so in some ANSI/ISO standard ?
|
|
|
|
|
to_be_unknown wrote:
Relying on the preprocessor to assign 0 to not-defined defines could be dangerous.
Absolutely. I'm not sure if it's in the standard or not.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hi
im having problems retreiving the values held in my combo box
the combobox holds a list of strings
i have
CComboBox* pLB = (CComboBox*) GetDlgItem(IDC_CNOCALLS);
int nIndex = pLB->GetCurSel();
DWORD n = pLB->GetItemData( nIndex);
however im getting a error on DWORD, and its not giving me the value in the combo box
can ne1 help
thanks
simon
|
|
|
|
|
If you want the value of a specific item you need the GetText()-function. Try this:
<br />
CString strText;<br />
pLB->GetText(nIndex, strText);<br />
strText will then hold the value of the item at position nIndex. If you need an interger (if your combobox holds numbers() just do int number = atoi(strText); .
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Try to Use
GetLBTextLen
GetLBText
GetItemData is a different function..check out MSDN.
|
|
|
|
|
Hi..All
i am using a Bitmap in a CBrush to display the pattern in a rectangular box at many places in the drawing of my vc++ application..
the problem is that on certain plotters the pattern is not displayed at all
although it is coming and very good in normal view and print preview.
and on some plotters it just display the crosses all over the rectangle.
and some time the pattern is displayed but it is so close that whole rectangle color becomes black...
Does any body have any idea why...
That would be very nice of him.
Thanks
Muhammad Kamran
Sofware Engineer.
|
|
|
|
|
Some vector based devices do not support that kind of drawing. Try calling GetDeviceCaps(DT_PLOTTER) when in print mode, and if it is true, don't draw using the brush. Typically, vector devices don't support the more advanced printing, like raster devices.
onwards and upwards...
|
|
|
|
|
Hi,
I am planning to develop a tool. It needs to work on a folder of size 2 GB. First it needs to remove the read only attribute for all the files in the folder. Then a third party tool will do some more processing and then my tools needs to delete all the files. This tools needs to work on Win2K. Presently i am using attrib and del dos commands. it takes hell lot of time to dothis task. I would like to develop something at the NTFS level to do this. Any pointers, samples will be of alot of help.
Regards,
Cutti
|
|
|
|
|
Unless I've misunderstood, couldn't you just use the Win32 API or MFC to change file attributes and delete files? CFile provides methods GetStatus() , SetStatus() and Remove() that may fit the bill.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Yes, something like:
void SetFilesToNotReadonly(LPCSTR cpFileDir)
{
CString cFileName;
WIN32_FIND_DATA sFD;
CString cFileSpec = CString(cpFileDir) + CString("*.*");
HANDLE hFind = FindFirstFile((LPCSTR)cFileSpec,&sFD);
if (hFind != INVALID_HANDLE_VALUE)
{
if (!(sFD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
cFileName = CString(cpFileDir) + sFD.cFileName;
SetFileAttributes(cFileName, sFF.dwFileAttributes & (~FILE_ATTRIBUTE_READONLY));
}
while (FindNextFile(hFind,&sFD))
{
if (!(sFD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
cFileName = CString(cpFileDir) + sFD.cFileName;
SetFileAttributes(cFileName, sFF.dwFileAttributes & (~FILE_ATTRIBUTE_READONLY));
}
}
FindClose(hFind);
}
}
onwards and upwards...
|
|
|
|
|
Hello,
how can i start another app from my application? After this i like to call the F4 Button?
Thanks in advance, Mark
|
|
|
|
|
ShellExecute() to start the other exe. To send a keystroke you might SendMessage(WM_KEYDOWN, ...) to the other application.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The simplest way is to use ShellExecute() .
ShellExecute(NULL, NULL, _T("myprog.exe"), NULL, SW_SHOWNORMAL); Look at the docs on ShellExecute() to find out what the parameters do and how to use them. To find out whether it is successful or not, ShellExecute() returns a value >32 if it is successful, and <=32 if it is not.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
macmac38 wrote:
how can i start another app from my application?
BOOL CreateProcess(
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
);
macmac38 wrote:
After this i like to call the F4 Button?
You want to call the F4 button? I'm not sure what you mean... You can kill the process using the TerminateProcess function (you got the handle from CreateProcess). If you want to simulate a press to F4 you can use the SendInput or keybd_event functions.
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Yep, i can call the .exe now when i press a button in my app. What i like to do is to simulate the pressing of F4 after this.
Because this starts a macro in the opened .exe.
I cannot understand the help for these functions you gave me and do not know which code to use for F4(Hardwareadress, number..???)
Do u have a code snip?
Thanks, Mark
|
|
|
|
|
SendMessage(wndOfStartedApp, WM_KEYDOWN, VK_F4, 0);
The first parameter is the HWND of the app you just started.
Instead of WM_KEYDOWN you might also try WM_KEYUP.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
mmh, i use NULL for HWND when i start the app. Nothing happens..
Thanks, Mark
|
|
|
|
|
It is normal:
the HWND defines which window will receive the message, then if you send the KeyPress to a null window...
you should start your app, then find the window of that app and after that send the message there...
I think that you can also do it better, and in order to do so, you should take a look at CreateProcess(...).
hope this helps.
|
|
|
|
|
But how can i find the window of that app? It is a commercial one. By the way i think i have to wait till the app is up before i send the message there?
Thanks, Mark
|
|
|
|
|
If you launch it by using the CreateProcess api, one of the parameters is a PROCESS_INFORMATION structure. This gets filled in with the THREAD HANDLE of the primary thread for the newly lauched app. After the CreateProcess call returns, wait for the app to initialize by calling WaitForInputIdle(). When this returns, then you should be able to simulate a keystroke with the PostThreadMessage api, passing the new app's main thread handle as the parameter.
Good Luck!
onwards and upwards...
|
|
|
|
|
Hi.
Does anyone know if there is a DirectX application wizard for use with the VC++ .NET version.
I am looking for something similar to the app wizard that is available for use under VC++ 6 ?.
Thanks.
James
|
|
|
|
|
;PDear All,
Is there any API which may simulate Deltree command.
I am developing a application for Windows 2000/NT/XP in which i want to remove all contents of a given folder .
Or any alternate way to achieve the same ?
Thanks
Rohit
|
|
|
|
|
Rohit Divas wrote:
Or any alternate way to achieve the same ?
Yes. You'll have to recursively go through the folders, delete each file, and then finally delete the folder. Of course, if a folder contains subfolders, then you'll need to go through that folder and delete all the files and subfolders in it etc., hence the recurson.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|