Re: linux to windows porting help



Duane Arnold wrote:
Rob Thorpe wrote:
vamsi wrote:

Hi,
Thanks all for the valuable suggestions.
Presently i am working on win32 console applications. My primary task
is to port all the IPC communication through Pipes, Message queues, and
shared memory from linux to windows.

Though i was able to do it successfully for Pipes and Shared memory, i
could not find a proper win32 API to implement Message queue
communication between two different process(one process is created from
other using CreateProcess, and these two processes must talk with each
other using MQ).

I found the following functions so far, which didnt help,

1. PostThreadMessage - for Message queue between process and its
thread.
2. SendMessage, PostMessage - uses the destination window handle as an
argument. but since i am working on win32 console application ... I
donn have any windows handle so unable to use these functions...

Are there any win32 API functions, where we can send messages to Queue
of a process using queue id like msgsnd() in linux???


Console applications in MS Windows have the ability to access all
Windows objects including hwnds, dcs, windows, dialog boxes etc. There
is really very little difference between a console app and a windowed
app except that the latter doesn't have a console. Note that an app
can only post messages to other apps on the same "desktop".

Ask the question on comp.os.ms-windows.programmer.win32 and someone
will probably tell you exactly which calls to use for your application.

If you already have a working Windows program I see no reason to
migrate it to .NET, it doesn't solve any problems.


I doubt that you have really seen both sides of the coin between the
power of a .Net solution as opposed to what is happening currently on
the MS platform. MS is going to leave the door open for awhile and then
they are going to close it. I have got a 1,500 page book on using
Windows API's and I'll never open it again.

I realise that .NET is a massive advance on the previous Win32 API.
(Which is more than a criticism of the Win32 than anything).

My point was about general programming practice though. It generally
isn't a good idea to re-write a program because of the existence or
otherwise of other frameworks/languages which are better than those
you're using. The best reason to rewrite is because the code _in the
program_ is bad. For instance, in this case the OP would have to
recode his program in C# which would be prone to much more error than
porting the C he has.

I doubt that MS will discontinue support for the older API since so
many programs use it. Though I know lots of people who write .NET code
I haven't actually come across anyone using a .NET program on a Windows
machine yet. Also .NET uses the older API internally making it
difficult for MS to discontinue it.

.



Relevant Pages

  • Re: linux to windows porting help
    ... Presently i am working on win32 console applications. ... PostThreadMessage - for Message queue between process and its ... donn have any windows handle so unable to use these functions... ...
    (comp.programming)
  • Re: linux to windows porting help
    ... Presently i am working on win32 console applications. ... PostThreadMessage - for Message queue between process and its ... donn have any windows handle so unable to use these functions... ...
    (comp.programming)
  • Re: Change project type in VC6
    ... If you have a win32 windows application, it receives windows messages that have to be handled to respond to certain events to open and close files for example, or respond to button clicks. ... the idea behind most console applications is completely different: you start a console application with certain command line options, and then let the program do what it has to do and finish. ... ofcourse because the project type is wrong, its looking for a WinMain entry point during linking - and failing. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: linux to windows porting help
    ... Presently i am working on win32 console applications. ... PostThreadMessage - for Message queue between process and its ... donn have any windows handle so unable to use these functions... ...
    (comp.programming)
  • Re: Help with VC6.0 Basic Concept!
    ... Can I use MFC in Console App? ... Console Application, Win32 Dynamic-Link Libray, MFC AppWizard and Win32 ... to know much about Windows and windows. ...
    (microsoft.public.vc.mfc)