|
Hi. I'm reading through some *very* old 'C' code that was created during the C89 standards - pre-1999. Basically, I've inherited some code from company A to support at company B.
Anyway, in one procedure I've located a #define that the original programmer quoted as it being local to the procedure.
Now, correct me if I'm wrong (of course you will! ); but, arn't #define's that are created anywhere in the code visible to the remaining portions of the project? That is, all remaining code, across files, that has yet to be compiled (from when the #define is declared) will contain the #define'd parameter until it is undefined?
Was there ever a difference in this behaviour between C89 and C99 conventions?
Thanks!
Carl
-- modified at 10:19 Wednesday 30th November, 2005
|
|
|
|
|
wow, i don't know at all about the old standard, but i never heard of a #define with a local scope...
[edit]
ok, misunderstood. yeah, the module end is limiting the scope of the preprocessor directives, but never a function body !
[/edit]
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 12:28 Wednesday 30th November, 2005
|
|
|
|
|
|
I am writing a program for a Scoreboard that contains a SplitterWnd, the upper Window (ScoreboardWnd) displays the whole screen with (Period Time, Scores, .. etc). The lower window contains all the Input’s and Buttons to administrate the Scoreboard.
I now want to display only the ScoreboardWnd on another VGA screen (Full mode).
I have looked at the CMonitor class and tested it properly.
On a Laptop with a 2nd VGA out I connected a 2nd TFT screen to see how the program works.
Now a few questions: How can I display out from a SplitterWnd a window on the 2nd screen?
On the laptop the whole program should be displayed.
The program is made with VC 7.xx!
It would be great if you have a sample for such a case I described above. Great work by the way!
Thanks in advance
Best regards
Karl
|
|
|
|
|
Hi all,
I want to run ACDSee from create process
this is the code i use:
STARTUPINFOW si;
PROCESS_INFORMATION pi;
ZeroMemory(&pi,sizeof(PROCESS_INFORMATION));
ZeroMemory(&si,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFOW);
si.wShowWindow = 1;
if(!CreateProcessW(L"C:\\Program Files\\ACD Systems\\ACDSee\\6.0\\ACDSee6.exe",
L"C:\\Program Files\\ACD Systems\\ACDSee\\6.0\\ACDSee6.exe",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi))
{
ASSERT(FALSE);
}
ok , the above code seems ok, but the problem is i pass the create process sucessfully, and i can't see any ACDSEE window open (nor i can't see the process in the task manager)....
if i use this substitue code:
ShellExecuteW(NULL,
L"open",
L"C:\\Program Files\\ACD Systems\\ACDSee\\6.0\\ACDSee6.exe",
NULL,
NULL,
SW_SHOWNORMAL);
it is working ok and ACDSEE is opened.
i can't use ShellExecute because i need some process information which PROCESS_INFORMATION structure holds....
can any1 help?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Not sure if this will work but the second argument of CreateProcess is the commandline parameters that will be sent to the program. So, replace it by NULL and try again.
|
|
|
|
|
doesn't work....
any other suggestion? anyone else?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I'm not sure if this is what the problem is as everything else looks ok, according at MSDN if your using using the si.wShowWindow property you need to set si.dwFlags to STARTF_USESHOWWINDOW else it'll just ignore it.
Out of interest have you tried changing it to launch Word or something to check the code is working ok?
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
also tried it (the STARTF_USESHOWWINDOW ) and still not working...
I tried creating process of notepad.exe and it works 100%!!!
i think the problem is the environment while i create ACDSEE 6 process...because it works fine with ACDSEE 3....not sure why though....
any thought?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
What does GetLastError() tell you?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
i've managed!
please see my other reply that summarize it all
thank you my friend
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Two potential reasons:
1) the lpCommandLine parameter of CreateProcessW() is the white-space delimited list of arguments passed as argv to the new process. If ACDSee expects to find the path to its own executable in argv[0] the above would fail, as your path contains whitespaces. Basically the result of the above would be: argv[0]="C:\Program", argv[1]="Files\ACD", argv[2]="Systems\ACDSee\6.0}ACDSee6.exe"
You should quote the string, e.g. pass it as:
L"\"C:\\Program Files\\ACD Systems\\ACDSee\\6.0\\ACDSee6.exe\""
2) The UNICODE-Version of CreateProcess() may fail on NT/2k/XP if the parameter passed as lpCommandLine points to a constant string. This is explicitly mentioned in MSDN. Note that the type is LPWSTR , not LPCWSTR . Maybe you should copy your string to a modifiable buffer and pass this buffer to CreateProcessW() :
I usually pass NULL for the lpApplication parameter and only use lpCommandLine . Of course, you have to make sure that a path containing white-spaces is quoted in this case (as described above). ShellExecute() is intended to be more "user friendly", that is it applies some heuristics to resolve pathes containing white spaces and does other "magic stuff".
Hope that helps
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Thanks for all the replies!
i've managed...the problem was that when creating acdsee6 process, you need to set up the acdsee environment (because it loads some dll that are located else where) so you can get the environment out of the registry and then use the 'SetEnvironmentVariable' method
this works 100%....
to discover that, i needed to hook the ShellExecute method, and learned that it calls CreateProcess behind the scenes, with the necessary paramters that one of them was the environment looking at the memroy of that variable, i've seen the acdsee directory reference (the one that the dll reside)...
so mission completed
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
hi,
I have built dialog based application and I would like to do print support there. Just picture from file or dc. It's MFC app but I can not figure out
how to get CDC for printing. Could someone give me some idea. Thanx
viliam
|
|
|
|
|
Does this help?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
The only examples I have found are for VS C++ 6.0; e.g. Circle, Button, CIRC1/2/3 etc.
Are they any articles/tutorials for VS .Net as the Wizards hav gone on .Net
Cheers,
|
|
|
|
|
Is it possible to use the DeviceIoControl() function to send commands directly to the driver for a COM port?
I am developing a time sensitive serial port application where I periodically need to change the parity of my serial data. Calls to Get_Comm_State() & Set_Comm_State() to update the parity are taking too long. I observed (using a serial port monitor) that these get and set methods do alot of unnessecary things like seting the baud rate etc.
It would be nice if I could use the DeviceIoControl function along with the IOCTL_SERIAL_SET_LINE_CONTROL command (or similar) to quickly change the parity from within my application. Am I living in a fantasy world or is this a possibility?
Many thanks
B_B
|
|
|
|
|
Hi all
I have an application window, which is created as
a child to the IE window(i'am using the Findwindow and SetParent API's
to set it as child to IE) which is working fine.
My problem is when ever the child window is minimized, it is displayed
in minimized state with in the IE window, but my requirement is to display
it on the TaskBar.
I tried to set the style of the window to WS_EX_APPWINDOW but it works
only for unowned windows.
is there any way to make it appear on the taskbar.
thanks and regards
pradish
|
|
|
|
|
Hi all
Does VC 2005 Beta version Support MFC,i have downloaded the beta version but there is no support 4 MFC ,not even header files, could anyone tell me the reason.
Thanks
|
|
|
|
|
The beta version is a beta of the Express edition. In the Express edition there is no suppport for the MFC and the ATL. Simply.
|
|
|
|
|
Hi ,
I have developed a VC++ 6 application under WINXP . But the platform where this application will run use Windows 2000. And under winodws 2000 when i ran this application it gave me this error ;
"The procedure entry point Rtllpv4StringToAddressW could not be located in
the dynamic link library ntdll.dll."
I have copied all the required dlls in win2k machine (by using Depends.exe tool, I copied my WINXP dlls) , but still getting the same error. I have also tried to copy the NTDLL.DLL of windows 2000 , but same error .
Can please anyone help ... ?
Regards,
ZINC
ZINC
|
|
|
|
|
You should not be redistributing DLLs from your Windows XP system directory. Windows 2000's Windows File Protection should actually be kicking in when you attempt to do this. Instead, you should use the Merge Modules that match your Visual Studio service pack version. Download for SP5[^], download for SP6[^]. Note that there are known issues[^] in these merge modules.
You need to be very careful about which file versions you copy to which operating systems, and how you get them there. The merge modules include (mostly) correct instructions for which files to install on which systems. If you're not using Windows Installer you may want to look for redistributable package installers which you can run from within your own installer. Getting it wrong can screw up your customer's whole system ('DLL Hell').
I would strongly recommend avoiding the Visual Basic 'Package and Deployment Wizard' (which I refer to as the 'Package and Destroy Wizard'). This tool regularly picks up DLLs from the Windows system directory rather than the Redist directory it's supposed to (default location: C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard\Redist) and also picks up many components that should not be redistributed. It can be used safely but is very hard to do so.
These days I generally use Visual Studio .NET 2003's setup projects to distribute applications, using the merge modules for distributing components I depend on, modified as instructed by the InstallSite page I linked to earlier.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi All
I am taking backup of Registry keys by using regedit command and, ShellExecute( ) is used to run this command from MFC based application, the code that I am using is as follows
<br />
<br />
ShellExecute(0,"open","RegEdit.exe","/e D:\\write1.reg HKEY_CURRENT_USER\Software\Microsoft\Windows NT",NULL,SW_SHOW);<br />
"Suppose that I have to take the backup of following key
HKEY_CURRENT_USER\Software\Microsoft\Windows NT
But this is not saved at desired path,
Caz, as I think there is a space in Windows NT .
So please suggest me that how shoul I remove this problem.
one more thing registry keys with no space in name is saved successfully.
Pls help me.
Thanks
Edit/Delete Message
|
|
|
|
|
You may use the standard registry operation functions to open and read data.
I am not sure if these are correct, I do not have MSDN installed on this machine, but I have worked a lot on dealing with windows Registry. I believe the following are the functions.
<br />
RegOpenKeyEx<br />
RegQueryValyeEx<br />
RegSetValueEx<br />
I would suggest you open the key, read value, and write it into a text file in BINARY MODE.
Hope this helps. If you need more information about how to do this, just write back a word.
Regards,
Rajesh R. Subramanian
Akruti Software,
Bombay, India.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
rajeevktripathi wrote: ShellExecute(0,"open","RegEdit.exe","/e D:\\write1.reg HKEY_CURRENT_USER\Software\Microsoft\Windows NT",NULL,SW_SHOW);
Use this instead:
ShellExecute(0, "open", "RegEdit.exe", "/e D:\\write1.reg \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\"", NULL, SW_SHOW);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|