|
Do you have a seperate thread(s) that is reading the data from serial port or socket?
I am unclear on how you get the data. It is there that you do the signalling. i.e. you signal the appropriate event when data arrives.
Generally when waiting for events to occur you are waiting for another thread / process to signal that it has something you are waiting for. When a thread enters WaitForMultipleObjects it stops execution of that thread while it waits. Subsequent code in that thread only executes when WaitForMultipleObjects returns.
Does this help?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
[edit] solved
Hi,
I have a List View Ctrl on a WTL dialog, with EDITLABELS style. However, as soon as I start editing the label, and press any key, applicaiton closes.
I had this behavior before, but I don't know what did fix it
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
Hi!
I have been having problems using this function, iI just can't seem to get it work. I have a CBitmap object, and I have to pass it to the function as a "Pointer to the file in memory from which to create the texture."
Can anybody help me, or even better, post some working code? I have tried many ways but none of them work
Thanks
Eugi Games
|
|
|
|
|
Hello!
It seems to me that setscrollinfo both updates the position of the thumb and scrolls the window. this annoys me very much because I want to scroll the window, and setscrollpos just ruins everything.. Is there a function that only sets the position of the thumb?
I'm using mfc.
|
|
|
|
|
You could try calling the API-version ::SetScrollInfo .
|
|
|
|
|
If i recall, position of the thumb is always relative to other information.
if Min is 0 and Max is 100, and pos is 50, then thumb position will be 50%. The scrollbar is probably attached to the document you're viewing so its normal that changing the pos or scrollinfo will move the view of the document.
Why are you trying to change only the thumb position ?
DarkByte
|
|
|
|
|
Because I'm writing an application that behaves like mspaint, and I use SetViewportOrg for scrolling.. Do you have a better suggestion?
|
|
|
|
|
How about you create the scrollbar yourself instead of relying on the scrollbars of the window. You could even subclass the scrollbar to add your behavior.
Other possibility is to control the repainting behavior so that you decide yourself when you try to repaint offsetted and when you dont.
There's probably many other different ways, but they all involve changing some default behavior somwhere.
DarkByte
|
|
|
|
|
Okay.. I just talked to a guy, who told me that I shouldn't be using CScrollView, because it behaves differently from other views. And true enough. When I switched to a standard CView, SetScrollPos didn't scroll my window anymore. I think that's werid.
|
|
|
|
|
i want to get the information and icon of shortcut of desktop by selecting with mouse. i get the list view of desktop shortcut and also i can get the selected index number of shortcut. i am using VC++6.0 and windows 2000 professional. "what i want is to get the icon image and icon name and shortcut link file name". the following code i am using. Mouse hooking is not needed.
HWND hWnd = ::FindWindow("Progman", NULL);
if (NULL != hWnd)
hWnd = FindWindowEx(hWnd, NULL, "SHELLDLL_DefView", NULL);
if (NULL != hWnd)
hWnd = FindWindowEx(hWnd, NULL, "SysListView32", NULL);
if (NULL != hWnd)
{
UINT count = ListView_GetSelectedCount(
hWnd
);
INT mark = ListView_GetSelectionMark(
hWnd
);
int nItem = ListView_GetItemCount(
hWnd
);
... ... ...
}
|
|
|
|
|
Ok, so is your code working? If not, what errors are you getting (e.g., compiler, linker, runtime)? Is the value of count , mark , and nItem correct?
Have you considered SHGetFolderPath() with either CSIDL_COMMON_DESKTOPDIRECTORY or CSIDL_DESKTOPDIRECTORY ? With the path, you can then use FindFirstFile() and FindNextFile() to "find" each file in the folder. Then you can use ExtractIcon() to get the icon used by the file.
I've not tried this specifically, so your mileage may vary.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
1-i want to notify to user when
a program try to access to internet do you think
is there any event in .net or in windows for this
purpose and if there is which events
2- i want to see all open ports in mycompuetr
somthing like netstat command in windows but iwant
do this programmatically
3-if i saw a port is open how can i close it
programmatically
koosha
|
|
|
|
|
Dear all,
I get a following linking error....I am working on VS.NET...can n e one tell why thi occurs and how can it be eliminated....
HanimCompute.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class MString const &)" (__imp_??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVMString@@@Z) referenced in function "public: virtual class MStatus __thiscall snMHanimator4Node::compute(class MPlug const &,class MDataBlock &)" (?compute@snMHanimator4Node@@UAE?AVMStatus@@ABVMPlug@@AAVMDataBlock@@@Z)
HanimNode.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,class MString const &)" (__imp_??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVMString@@@Z)
Thanks,
Raj
|
|
|
|
|
Which is currently the fastest method to read a text file into memory.
I am using ifstream and get and would like to know of anything better.
|
|
|
|
|
Are you doing ifstream::read()?
What is the length of the data block you are reading? Try increasing the size of the chunks you read if it's reading too slowly. Reading 1 byte at a time is incredibly slow but reading 1MB at a time will be really fast.
|
|
|
|
|
The length of the data block is the entire filesize (which varies)...in my case it is around 500K at the moment...the entire file is read w/ one get.
It is not that slow, I just thought there may be a faster way.
|
|
|
|
|
I have experimented with this now and again and always found that blocks of 2,4 and 8k ranges provide the best performance. I have always assumed that there must be variants across systems that might effect this. OS, File System, Disk Drive and probably more.
It is relatively simple to create a console app that allows you to test variations.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
What are you doing with the file? Memory mapped files deliver impressive performance and may be suitable for your task.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Hmmmm!
1) Open file.
2) Get size of file.
3) Allocate enough memory to hold entire file.
4) Read file into buffer.
Of cource this only applies if file size if smaller than the maximum buffer size that you can allocate. Under Win32, you can allocate very very large buffers.
INTP
|
|
|
|
|
Yep, that's exactly what I did, just making sure it's the fastest way.
Thanks for the help.
|
|
|
|
|
Sir,
THis is my first application with hooks.
I amtrying to register WH_KEYBOARD hook for my app so that when ever I tried to make Caps tab on this will set to off.
So I placed a gloabl variable of HHOKDATA and a glabal proc -KeyboardProc.
I placed these globally in CMainFrm.cpp
I registered this hook using using SetWindowsHookEx and called in OnCreate of CMainfrm.cpp.
But this is not getting called and let me know what to do so that this hook should call .
Should I map the events ????
But hooks will getcalled only before the event is passed to WndProc?
Pls correct me if I am wrong.
Where I am going wrong?
|
|
|
|
|
blacktiger007 wrote:
I registered this hook using using SetWindowsHookEx and called in OnCreate of CMainfrm.cpp.
But this is not getting called and let me know what to do so that this hook should call .
What is not being called? SetWindowsHookEx or the hook you are trying to install?
blacktiger007 wrote:
But hooks will getcalled only before the event is passed to WndProc?
Hooks are called before the window message is delivered to a message pump.
If you are trying to install a global hook, please note the section in the MSDN docs: The global hooks are a shared resource, and installing one affects all applications in the same desktop as the calling thread. All global hook functions must be in libraries. Global hooks should be restricted to special-purpose applications or to use as a development aid during application debugging. Libraries that no longer need a hook should remove its hook procedure.
Are you installing a global hook? If so, do you really need the global hook? If you are installing a global hook and you really need it, there's this[^] article.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
I called a global hook and wrote the code in CMainFrm.cpp fie and called SetWindowsHookEx in OnCreate of CMainFrm.
I wrote the code KeyboardProc here.
When I tried to debug it ,The actual KeyboardProc deined in this file is not geting called.
Pls solve this as I will extend this app using DLLs later.
|
|
|
|
|
I'll recite the MSDN docs again: All global hook functions must be in libraries.
Those are the rules. Period.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
sir why not use a dll to set the hooks and put the callback function there.
The virtual keycodes for capslock and tab are:
VK_CAPITAL 14(value hexadecimal) CAPS LOCK key
VK_TAB 09(value hexadecimal) TAB key
So in your callback function you'll have to monitor whenever these key are pressed and when they are pressed instead of returning 0 (as success) return 1 (as error).
And there you are
gabby
|
|
|
|