|
Thanks a LOT!
|
|
|
|
|
I have another stupid question now. I've downloaded this sample and traced it. but I can't find where the code of putting data into the FlexGrid. I also know that the methods, SetTextMatrix() and SetText(), which can performance that job. But how the sample does that without those methods?
|
|
|
|
|
Appreciate any guru's comments and advise on the feasibility of my intended project.
I have a DOS-based application program that interacts with an piece of equipment through COM1. I would like to write a program to peek at the serial data going in/out of COM1 and send them to a remote terminal using TCP/IP.
There is a utility on the Internet called TCPCOM, but that requires a Y-cable to loop COM1 into COM2.
My questions are:
1. Can I open the serial comm port in VC++ when the COM1 port is already in use by the DOS app?
2. Will the Opening of the serial comm port cause a momentary break in COM1?
3. What if the application is Windows-based? Is it possible for 2 windows apps to share a COM port?
Regards
|
|
|
|
|
Go to sysinternals.com and download the free utility, portmon. It's very good, and might even suit your needs on it's own.
the description of portmon on that site tells you how they implemented it. the source might be available for download, i'm not sure (some of their tools have source, some don't)
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Something like that, but I need to send all the bytes to the remote terminal over an IP network.
Using mirroring software like Carbon Copy, PCAnywhere, etc is inadequate as they would limit one local PC to one remote terminal. Furthermore, my company's IT Dept disallow the use of such products.
So I really hope someone can provide some guidance.
Thanks.
|
|
|
|
|
et wrote:
1. Can I open the serial comm port in VC++ when the COM1 port is already in use by the DOS app?
No, you can't opena com port if it is in use by another program, that includes a DOS program.
The way to peek at data is to rcv (pin 3) to a new plug. You can then open the new COM port without affecting the original line. I assume this is what you mean by Y cable.
Normski. - Professional Windows Programmer
|
|
|
|
|
Hi,
I have two application which need to communicate though a dll (one application is written in C++, the other in Java). The Java application makes calls to the dll through its native interface. My problem is the following:
The dll has to transmit data (just a string and a float) to my C++ application which should immediately react. I use a shared data segment in my dll. The data which has to be transmited is first stored in that data segment, and then my C++ application periodically looks if something in the shared data segment is waiting. This is not so elegant and also my C++ application doesn't immediately react since it only does polling.
What is the best way to proceed? Should I use a PostMessage to announce that there is data waiting? And in that case will my C++ application immediately be able to react? (the C++ application is just a dialog doing nothing if no button is pressed). Or can the data directly be transmitted in a PostMessage? (there's just a string and a float to transmit).
Should you have some good idea, please let me know
Thanks
|
|
|
|
|
Hmm, there are a couple things that i can think of anyways.
If you have the DLL working in both projects already with shared memory, you can either poll a variable in your c++ code (a byte set to 0 for no-change or haschange). You can do this as little as once a second or in a tight loop depending on your needs. Not generally a good idea though, so i recommend:
Sending a windows message with PostMessage/SendMessage.
PostMessage is will return as soon as the message is dispatched, sendmessage waits for recipt confermation. Only use sendmessage for intra-process for deadlock reasons. So your left with PostMessage.
you can PostMessage an address in the DLL, or simply use the fact that the message has been sent to check pre-defined areas in the DLL. Either way is a good way of going.
Post/sendMessage can only send two 32-bit numbers, so you cant send a string. You could try packeting through the message pump, but thats just plain silly.
// Rock
|
|
|
|
|
There are some other (more efficient) methods too: Events, Pipes, Mailslots, etc.
Simplest solution is to prepare the data and raise an event. The receiving DLL will WaitForSingleObject/WaitForMultipleObjects on that event. And then requests/reads the data.
No polling, no SendMessage/PostMessage. Additionally you can secure the communication by using object level security.
At the same time you gain also real synchronization between sender/receiver.
|
|
|
|
|
Thanks for your kind help, I got it to work correctly
|
|
|
|
|
Hi,
I've allowed my MDI application to have a web browser by using the CHtmlView class. A problem I am having is that when a web page launches a seperate window it is started outside my application in Internet Explorer, which isn't so much of a problem. The major problem is that if I log in to my account on this site and then an extenal window is launched it loses it's cookie and says the session has timed out. Do I need to set a cookies directory or something?
Thanks
|
|
|
|
|
anyone? please????
|
|
|
|
|
Can someone tell me if a problem i seem to be having(if it is a problem) is a problem? When i
Allocate and reAllocate and the memory grows in size, i can't downsize the allocated memory when it's no longer needed.
Meaning...If i start at 8 bytes and it grows to 32...no matter how i call
ReAllocate, even if i specify the size as 0 it stays at the last size According to GlobalSize anyways...
Is this a problem...?
TIA
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|
|
According to MSDN, GlobalRealloc should not be used, for reasons of speed as much as anything, unless you're doing something with DDE or the clipboard.
Generally speaking ( assuming you're not using DDE or the clipboard ), you should prefer the C++ memory management functions unless you're programming in C.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I have dialog base application(MFC).
I want my dialog be hidden.when I use:
showwindow(SW_HIDE);
nothing happend??
I also use this in InitInstanc():
CDlg dlg;
m_pMainWnd = &dlg;
m_pMainWnd->ShowWindow(SW_HIDE);
but run time error happen???
|
|
|
|
|
The above code creates an instance of a dialog box, but does not initialise it. You can't show or hide a window that has not been created.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
There's an article on CP describing how to DoModal() on a dialog and have it hide immediately.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Jon Hulatt wrote:
Sorry to dissapoint you all with my lack of a witty or poignant signature.
lol
Put quotes around it and you're there...;)
(sorry - I just couldn't resist it!)
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
"I would be careful in separating your wierdness, a good quirky weirdness, from the disturbed wierdness of people who take pleasure from PVC sheep with fruit repositories."
- Paul Watson
|
|
|
|
|
Would u please tell me the link?
Thanks a lot
|
|
|
|
|
I don't know if Jon was referring to this post of mine, but anyway there you'll find how to have your dialog hidden on startup.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Why would you want to? compilation of file order is irrelevant!?!
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
The order maybe bases on your head files' order.;P
|
|
|
|
|
Hello,
I have a MDI app. and in the status bar I have a progress control.. The problem I am having is when ever a long function is taking place my app freezes until the function is finished (because of the progress control). If I remove the progress control everything is fast and smooth.. How can I create a progress control in the status bar with out killing my application performance? Here is a sample of the code I use to create the progress control.
void CMainFrame::DownloadProgress(long nProgress, long nProgressMax)
{
RECT MyRect;
m_wndStatusBar.GetItemRect(1, &MyRect);
if (m_bCreate == FALSE)
{
m_Progress.Create(PBS_SMOOTH | WS_VISIBLE | WS_CHILD
, MyRect, &m_wndStatusBar , 1);
m_Progress.SetRange(nProgress,nProgressMax);
m_Progress.SetStep(1);
m_bCreate = TRUE;
}
for (int i = nProgress; i < nProgressMax; i++)
{
m_Progress.StepIt();
}
}
Any pointers?
Thanks,
Rob
|
|
|
|
|
It sounds like you're doing everything in one thread, no? If so, read the VC forum FAQ (link at the top of the page) that addresses your question.
--Mike--
"Why you keep calling me Jesús? I look Puerto Rican to you?"
-- Samuel L. Jackson in Die Hard 3
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|