|
Hello !
I open a serial port using the CreateFile function. I would like to know the number of bytes that are in the in queue of this port. Of course, witout removing them from the queue...
Any idea of how I can do that ?
Thanks
|
|
|
|
|
You can use the ClearCommError function (even though the name does not suggest it.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Yes, the name of the function was not really what I was expecting.
Thank you
|
|
|
|
|
I have a CEdit control on a dialog box and I'm creating a dynamic rectangle on the CEdit but it doesn't scroll vertically when I put the rectangle on the bottom of the CEdit?!! I've set the multiline+ vertical scroll parameters
Please help me! my code has come below:
CRect rc, statusRect;
GetDlgItem(IDC_GRAPH_EDIT)->GetWindowRect(rc);
CWnd* pWnd = GetDlgItem(IDC_GRAPH_EDIT);
ScreenToClient(rc);
statusRect.top = rc.bottom - 40;
statusRect.bottom = statusRect.top + 20;
statusRect.left = rc.Width()/2 - 40;
statusRect.right = statusRect.left + 80;
m_dynamic = new CButton;
m_dynamic->Create("Dynamic",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_OWNERDRAW|BS_MULTILINE,statusRect,pWnd,2000);
m_dynamic->SetFont(fontGeorgia);
m_dynamic->SetColor(BLUE, LBLUE);
m_dynamic->ShowWindow(SW_SHOW);
I've tried the following codes but it didn't help:
((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->SetSel(GetWindowTextLength(),-1);
or
((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->PostMessage(WM_VSCROLL, SB_BOTTOM);
UpdateData(TRUE);
or
((CEdit *)(GetDlgItem(IDC_GRAPH_EDIT)))->LineScroll(2);
Any idea or suggestion will be appreciated.
thanks
|
|
|
|
|
CEdit represents a simple text editor, even if you subclassed the control I dought you could do it. The edit-control client area does not actualy scroll, that's an illusion. When you scroll the text it just changes the position of the upper left courner character, where drawing is to start. The edit-control would have to think that your custom-control is part of the text.
If you need to insert an object into an edit type control then you should be using CRichEditCtrl, and even then it may need to be an OLE control.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Well.....actually I'm going to draw a graph (some colored rectangles that are connected by some colored arrows) on a dialog. Since the display sould be always like a single vertical line of boxes with a scrolling feature, I though CEdit might be a good choice.
Now.. I'm waiting for your suggestion for such an implementation
Thanks a lot
|
|
|
|
|
If you have not already visited controls section of CP, then give it a shot. There are two graph controls at CP that I know of (one is it ATL/COM section). The other two choice would be to: look into how to use a view (CScrollView) in a dialog box or write your own code to handle the scrolling.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
;PThrough registry, will I able to know the information from a mounted drive. (ie LBA, PID, VID, drive letter).
|
|
|
|
|
Hi
Read the keys at
HKEY_LOCAL_MACHINE\System\MountedDevices
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
I encountered a problem today. I have a dialog containing a rich edit control which I use to highlight certain parts of a text. The control is set to readonly in the dialog editor. I also use SetOptions() to set it as readonly in OnInitDialog. This works pretty much ok.
When I select a text snippet, I am able to drag the text and drop it into any other window accepting text. But when I do, the selected text is deleted from the read-only rich edit control.
Any ideas?
|
|
|
|
|
Hi,
I want to display a simple dialog that displays "Please Wait..." while a task is performed then goes away by itself when the task is complete.
What's the simplest way to do this?
Thanks,
Ali
|
|
|
|
|
when the task ends, just send a WM_CLOSE to the window displaying the "please wait..."
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
In VC++ 6, there's an add-in to insert a progress dialog box. (not sure about vc++7) Once inserted, you could strip out the progress controls/code, and use the default static control for your "Please wait..." message.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Hi
You can use CStatic Class to show "please wait..." message.
if u wanted to know when task ended u can use Threads API functions or MFC threads functions as AfxBeginThread(threadfun,hwnd,threadpriority) ,
then create thread and Use WaitForSingleObject(....) API function to determine when your task ended
.
if u need more help contact me on faroq_tam2004@yahoo.com.
If this dos'nt help u im sorry.
Bye.
On Earth nothing impossible,
while your mind running.
Faroqtam
|
|
|
|
|
hi CPians, toxcct again.
another wish i had for my prog was to have the possibility to switch all the text between French & English.
I so used the default string table (french) to insert the french strings, and created an US english for the translated strings. all the strings refering to the same thing in both tables had the same IDs (#define names).
Questions :
1. Am i right to set the same IDs (#define names) in the string in both tables, or do they only need to have the same value (int) ?
2. how can i switch from one language to the other and vice versa ?
3. Is there a better/simplest way to do this far away from what i am doing now ?
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Can't say whether it's the best way of doing it, but I use resource-only dlls.
How To Create Localized Resource DLLs for MFC Application
You should also search for "satellite dlls" at MSDN, I think there's an example project.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
In our app we have support for 3 languages (quite a drag and a lot of overhead)
We give the same names in the string tables for all three languages. (make 1, copy it and change the text)
When we change the language setting of windows our app switches too.
Good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
ok but, how to change the language while the application is running ?
i have a combobox with 2 entries ("Français" & "English"), and i would like (when a selection change is detected) to alter all the strings from one table to the other associated with the selected language.
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
In that case I would think ahead.
Load your captions dynamically with an xml document. This way you can add languages very easy in the future.
You should then still find a solution on what to do when your app changes etc. So maybe not a good track either.
I'm not sure it's so easy to what you want, maybe you can trigger the table-change, but I wouldn't know how , sorry.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
i cannot do this with string table ressource ?? strange
if anybody knows... don't worry, tell me
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Hi .
u can create 2 Dll files with your resources and
then use API function to load your resources as u wanted.
On different Dll files u can use the same ID for the string.
that is mean only change the dll file for specific language.
for Example create Eng.dll file for English Version and
Frn.dll for France Version.
this make your program more esaer to development.
Bye.
On Earth nothing impossible,
while your mind running.
Faroqtam
|
|
|
|
|
What I did to solve this problem was put all the strings in a *.ini file (you could also use a *.xml file as suggested by V). By using this method, other people can add as many translations as they want, without you having to recompile your app or any extraneous dlls.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
hi CPians,
i have a strange fact. I'd like to add to my program a set of shortcuts (like Ctrl+O to open documents for example). i created the accelerator table and associated each shortcut with a menu item ; without effect.
What did i forget to allow my shortcuts to work ?
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Did you try calling LoadAccelTable on the CMainFrame class?
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
i use a dialog based app, and i think i already used LoadAccelTable(), without success.
do you have a piece of code to show me how to use it ?
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|