That's what I ended up doing.
Shay Harel
Posts
-
Prevent context switch -
Prevent context switchnice but in kernel I prefer to use more orthodox stuff :) My question was for something I am doing in user space.
-
Prevent context switchYep, pretty much what I had in mind... Thanks.
-
Prevent context switchDoes anyone know of a way to prevent context switch in a block of code? As far as I can tell (unless I am wrong) Critical Sections do not guarantee not to switch context, it simply means threads can't access a shared resource. I am looking for some API that will guarantee an atomic execution of a block of code (if this API even exists) Shay
-
METHOD_BUFFERED when using DeviceIoControlThanks Dave, I ended up finding this link as well. Shay
-
METHOD_BUFFERED when using DeviceIoControlHi, When using DeviceIoControl with METHOD_BUFFERED, will the buffer that windows allocate in kernel (the one that is the copy of user space), would it be taken from the non paged pool ? I was looking for more specific documentation on the subject and did not find something explicit. Thanks, Shay
-
Async Socket"The problem is you're using CAsyncSocket, which by default needs the message pump working to dispatch asynchronous socket notifications." This is exactly the root cause of the problem I guess. I did not know the Async socket rely on the message pump, I was sure it's a thread of it's own. Looks like I'll have some threads going... Thanks !
-
Async SocketWow, All I asked for was a technical solution :) I have done many multithreading in my life, don't loose sleep over it. I was under the impression the listening socket would not be affected from the blocking, that's all. As for the expected blocking of the GUI, I am aware of that, but my traffic is always quick enough for the client to respond quick enough not to notiec the GUI bloking. Also, this is just a prototype at this stage so I don't mind the GUI blokc. In the future, the code that would use the DLL would have a thread of it's own. But if the listening socket would be blocked by this thread I am at the same state. Sync sockets should seems like the only solution but I wanted to avoid it...
-
Async SocketHi, I created a DLL that exports an API for a GUI to use. The GUI call the API and when the function returns, it expects to have some value set in the memory sent to the API, so far so good. The DLL itself implements the API by sending some information over CAsyncSocket. Here is my problem, When I send the data from the DLL to the client, I basically need to block until the client returns my packet back. I do that using a HANDLE set up as an event. When the client would return my call the OnReceive of the socket would get called and then I would set the event. However..... It seems like the blocking (WaitForSingleObject (event, INFINITE)) seems to prevent the listening socket from receiving the reply. Once the blocking is commented out, I get the reply from the client. The problem is that if I remove the blocking my API returns right away and the the GUI has nothing in the buffer :) I know this can be solved with some threading and callbacks and so on. BUT... the listen socket should be a thread of it's own and not be affected by the infinite wait of WaitForSingleObject . what am I missing ?
-
Sending asynchronous IOCTL from user to kernelHi, I know there are a few good articles regarding driver development here, but unless I missed it, I couldn't find something about sending an asynchronous IOCTL from user space to kernel. Any help or link would be great.
-
Right click on tree control will not select the itemexcellent ! that did the trick, Thanks a lot
-
Right click on tree control will not select the itemHi, I am using a tree control in a simple GUI. I responded to a right click on the control and popped up a context menu for it, so far so good. Next, I want to know which is the HTREEITEM that was selected, so I can do something with it. The problem is this will work only if the item was first selected by a left click first and then the right click. If I select an item by docuble click so it will open all of it's sub items and then right click on one of the sub items, the GetSelectedItem function will return me the root item and not the one I right clicked on. any solution ? Here are my right click and menu handling functions:
void Cfbe_sim_guiDlg::OnNMRclickSystemTree(NMHDR *pNMHDR, LRESULT *pResult) { DWORD dwPos=::GetMessagePos(); CPoint point((int)LOWORD(dwPos),(int)HIWORD(dwPos));//convert mouset to point object CMenu menu; menu.LoadMenu(IDR_MENU1); CMenu *pContextMenu=menu.GetSubMenu(0); pContextMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON, point.x,point.y,AfxGetMainWnd(), NULL); *pResult = 0; }
void Cfbe_sim_guiDlg::OnTreeObjectproperties() { /*get handle to the selected item*/ HTREEITEM selected_item = m_ctl_system_tree.GetSelectedItem(); /*get the text of the selecte item*/ CString item_text = m_ctl_system_tree.GetItemText (selected_item); . . . }
-
Forcing cursur to stay in CEditHi, This is actually a second part to a previous option. Assuming I "caught" the VK_TAB in PreTranslateMessage function of my custom CEdit control and did what I want. Now, how do I force the cursor to stay at the end of the line inside my CEdit control. right now, after I am done processing the VK_TAB, the focus goes to the next control. I want to prevent that. I tried SetFocus and return w/o running the CEdit::PreTranslateMessage after my processing but that did not help. Thank.
-
Responding to TAB in CEditthat did the trick
-
Responding to TAB in CEditHi, I have sub classed CEdit and I can get notifications for example in the OnKeyDown function for any VK_XXXXX keys. From some odd reason, the VK_TAB is not responding, any reason why ? Basically, what I am looking for is to do auto complete Linux type. I already have the data to auto complete and I just want to do it with the TAB key. The problem is that no matter what I tried, the TAB always does what it's "programmed" to do in windows, it jumps to the next field. Any help is appreciated. shay
-
How to select a single word in a list control ?Hi, I have a simple dialog that has a list control which displays a history of commands entered into the system. Let's say I want to select the last argument from a command and copy and paste it somewhere, I just can't do that in a list control since it let me select the whole line only. I tried using rich edit, but it has no notion of AddString which just adds text as we go. Is there any control out there to solve this problem before I sub class Rich Edit ????? Thanks.
-
How to sense up/down arrows in CEditthr first one was just an autocomplete, the second one was better. thanks
-
How to sense up/down arrows in CEditHi, I have a simple GUI in which I want to implement a history feature of keywords that were typed in the CEdit box. How can I get a notification when the up or down arrow keys were preseed when the CEdit control is in focus ? Thanks,
-
CSliderCtrl questionWhy couldn't I think about it before :) BTW, I am using VS 2003 and it also need the Tick Marks property checked. Thanks !
-
CSliderCtrl questionHi, I am using a slide control in a dialog and I used Visual studio to create it and place the slider on it. When I want to add the tick marks, I have a problem. I must use the Create function for that with the "TBS_AUTOTICKS" flag, but the problem is that I can't use the Create function since Visual Studio already did it for me using the macros. Any way to set this flag or override the Create function macro ? Shay