|
Well im having problems with the below code in the bold and italic line, because i don't want to hardcode the process which i want to create (mychildprocess). I want it to be one of the commandline arguments.
[code]
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
TEXT("MyChildProcess"), // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
[/code]
So what can i replace TEXT with?
oam
|
|
|
|
|
mpapeo wrote:
Well im having problems...
Meaning what?
mpapeo wrote:
if( !CreateProcess( NULL, // No module name (use command line).
TEXT("MyChildProcess"), // Command line.
Per MSDN:
The lpApplicationName parameter can be NULL. In that case, the module name must be the first white space-delimited token in the lpCommandLine string.
You've not specified a valid module name for the lpCommandLine parameter.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I dont understand that, if i specify the MyChildProcess as the commandline argument it execute correctly, but then if another process which has not been specified there it doesn't execute it but instead it still execute the hardcoded one.
And what should i specify for the lpCommandLine parameter?
oam
|
|
|
|
|
Ive solve it by putting argv[]
oam
|
|
|
|
|
hello,
I have created an application that works fine for WIndows I want to port this application to MAC how can I do this
|
|
|
|
|
hello,
I have created an application that works fine on Windows .How can I port this application for MAC
|
|
|
|
|
To answer the topic question, no I don't believe Visual Studio can compile for Mac execution. It may be a hidden feature but not one I'm aware of. Given MS dislike for Apple I don't imagine they'd make software that can support Apple hardware.
For a little side note lesson, one which you may already know, the main reason program execution can't be directly taken from one machine to another ( Intel -> Apple, Apple -> Alpha, etc ) is because of the CPU architechture. The CPU internals just work differently which is why code needs to be ported rather than just copied over.
If you're using ANSI standard C++ ( nothing unique to .NET, Windows environment, DirectX, etc ) all you need to do is copy the the source code and build it on a Mac with a C++ development suite. I'm not familiar with Mac development so I can't recommend a good Mac IDE. Being as .cpp and .h files are just strict ASCII text files they're universally recognizable so you should be able to just copy them straight across.
If you are using Windows unique code, DirectX, or anything like that, you'll have to replace those sections with Mac compliant code. As far as I know there's no way around this.
The question "Do computers think?" is the same as "Can submarines swim?"
Signature Red Studios
Jeryth
|
|
|
|
|
you can't, well, not easilly ... you will probably need to recode most/all of the UI, rewrite most/all file access routines, and probably graphic thingies ( if you doing things like that ).
and if you use Objective-C, then, I think you will need to do A LOT OF WORK doing bridges between Objective-C and C++.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I strongly recommend rewriting your app in Java or Qt[^] instead of simply porting it to the Mac.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
In VC++ 4.0 with MFC 4.0 you could cross-platform develop for Win and Mac (using MFC), but AFAIK that feature hasn't been included in any newer MS VC compilers.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Visual C++ 4 did provide cross compilation. Only for Mac OS 7 till 9, never for anything beyond.
It is secretly believed that Micrsoft did continue development on a Mac version of their new compilers but none of them were available to the public.
If you target Mac OS X, it is impossible to use this compiler. You will have to revert to other tools.
If you target the older platform (minority of Mac users now), you can still use that compiler but the native mac tools are much better.
I did a couple of years back a project where we started with Visual C++ cross compilation and we ended up migrating to Metrowerks.
For mac cross compilation, you need both machines sitting next to each other (same appletalk network).
Given the difference in quality of current compilers on all platforms compared with the old Visual C++ 4, I strongly recommend you to seek native solutions when compiling for the Mac. For Mac OS X, the development tools from Apple are free.
Good luck, and drop me a line at macchess at internetcontact.be if this helped.
|
|
|
|
|
Hey guys, I'm new here and not very experienced with C++ so I'd appreciate any help.
I'm trying to read a binary file and put the contents into a structure. However, I run into a problem whenever I come across 0x08, which results in my code only reading 8 instead of 08 into my structure. Here is part of my code.
// structure i'm using
struct something
{
char head1;
char head2;
};
int main()
{
something packet;
fstream data;
fstream output;
// open the file for input in binary mode
data.open("test.dat", ios::in | ios::binary);
output.open("dataoutput.dat", ios::out);
// reading contents of file
data.read(reinterpret_cast<char *="">(&packet), sizeof(packet));
output << "Primary Header Info: " << endl;
output << packet.head1 << packet.head2 << endl;
data.close();
output.close();
return 0;
}
The result I get in my strucutre is 820 instead of 0820. Any ideas as to why ? TIA
|
|
|
|
|
The Problem is called struct member alignment.
see msdn : struct member alignment
the compiler inserts extra bytes to optimize it for a cpu.
the standard alignment is 8.
To make your code work, you have to insert
#pragma pack( push, 1)
struct
{
//..
};
#pragma pack(pop)
the pragma enables aligment of 1 byte.
This is not a good way to solve your problem.
You better insert 2 methods to read/write your struct memberwise.
This is called serialisation.
|
|
|
|
|
What does the test.dat file look like? How are you verifying that packet.head1 and packet.head1 do not contain the correct values?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I've implemented a wizard using the CPropertySheet and CPropertyPage classes.
When i'm in a particular page of the wizard, when i click the "Cancel" button or press ESC or close the page by clicking on the "X" in the right top corner, the CANCEL message gets fired and control comes to the OnCancel command handler. At this point the PSN_WIZFINISH notification is not sent.
void CMyPropertyPage::OnCancel()
{
ASSERT(m_pSheet != NULL);
m_pSheet->EndDialog(IDCANCEL);
}
Now I have a scenario where i have to forcefully close the wizard by sending
SendMessage(WM_COMMAND,IDCANCEL);
Now after the CANCEL message being sent, the PSN_WIZFINISH notification is also sent
In my class, i've overridden the OnWizardFinish to do some functionality.. So when i do a "SendMessage" i dont want the PSN_WIZFINISH to be sent ..
why does it work this way and how do i avoid it ?
Thanx for ur help.
|
|
|
|
|
Hi!
Is there a way to call a managed DLL from an unmanaged MFC class?
MSc Bertil Morefält
|
|
|
|
|
Take a look on the following code:
if ((A) && (B) && (C))
{
...
}
If A evaluates to FALSE Will B or C be evaluated?
Hint: For built-in types A, B and C, the C++ language description by Bjarne Stroustrup defines that B and C will not be evaluated if A is FALSE.
What if A, B, C are macros that expand to complex functions that also do some assignments as side-effects, will this be true also?
What about compilers that do optimizations, or their optimizations have been disabled?
What about plain 'C' code, Do short-cirtuit rule mentioned above is relevant?
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
I believe that the C language specifies that the short-circuit will always take place so that you can DEPEND upon this behavior to avoid problems.
Consider this simple function (which is in our code now...)
BOOL IsEmpty(char* string)<br />
{<br />
if( string && string[0] ){<br />
return FALSE;<br />
}<br />
return TRUE;<br />
}
I am relying upon the short circuit test of string as a pointer to be NON-NULL and the test failing, otherwise I might try to dereference memory I don't own! (Dereferencing a memory address at zero which will lead to the fatal 'access violation' exception on Windows)
|
|
|
|
|
rbid wrote:
If A evaluates to FALSE Will B or C be evaluated?
No. This is ALWAYS the case.
rbid wrote:
What if A, B, C are macros that expand to complex functions that also do some assignments as side-effects, will this be true also?
Yes.
rbid wrote:
What about compilers that do optimizations, or their optimizations have been disabled?
This is nothing to do with optimisations. It's in the standard.
rbid wrote:
What about plain 'C' code, Do short-cirtuit rule mentioned above is relevant?
Yes, it's in the C standard.
Ryan "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"
|
|
|
|
|
Be aware that if you define your own overloaded operators &&, || etc. that they will NOT short-circuit!
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
1. An input array and an output array is passed from Javascript to C++ prgram.
2. C++ program receives the passed javascript arrays as VT_DISPATCH SAFEARRAY's.
3. 'ADO Command' parameters created from the passed input and output arrays and a stored procedure is called.
4. Stored procedure copies input array values to output array.
5. when trying to copy value from the command object back to the output array I am facing problem.
Shown below is the code.
if(varOutParams->vt == VT_DISPATCH)
{
CAuto<safearray*, csadtor=""> ppsaOUT(SafeArrayCreate(VT_VARIANT, 1, 0));
DispToSafeArray(varOutParams->pdispVal, &ppsaOUT);
SafeArrayAccessData(ppsaOUT, (void **)&varArrParams);
int iCounter = 0;
for (prmIterator = vecOutParams.begin(); prmIterator!= vecOutParams.end(); prmIterator++)
{
pPrmObject = *prmIterator;
pPrmObject->get_Value(&varArrParams[iCounter++]);
}
vecOutParams.clear();
SafeArrayUnaccessData(ppsaOUT);
}
|
|
|
|
|
Does somebody know, how to do this?
|
|
|
|
|
Does the PrntScrn key not work, or are you wanting to do it via code?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have to add an ability to get "screenshots" of fullscreen dos apps to some opensource vnc (UltraVNC, TightVNC or something other...) in order to make possible to programm our samsung office phonestations remotely (7 ones in the different towns). Their program (pcmmc80) is run in fullscreen graphical mode and somewhy doesn't run in VMWare and other VirtualPSs =(
|
|
|
|
|
Hi
Iam calling a fortran function from c++ code.Actually it enters into the fortran code , but it not passes the correct argument values.instaed of passing 1 & 8 valeu it passes the 0 value to the fortran functions.
Please help me to solve this problem.Below is my code.
fortarn function (DLL:Dynamic linked linrary)
SUBROUTINE MATH(INTEGER A, INTEGER B)
!DEC$ ATTRIBUTES DLLEXPORT ::MATH
PRINT*, "Oops!!! I am ForTran manager..."
INTEGER SUM = A+B
PRINT*, "after sum in fortarnlangauge"
PRINT*, SUM
RETURN SUM
END SUBROUTINE MATH
C++ CODE(EXE)
#include <iostream.h>
extern "C" __declspec(dllimport)
int __stdcall MATH(int a , int b );
void main()
{
cout<<"iam checkimg the mixed langauage programming"<
|
|
|
|