I dont have multiple touch devices (had to buy this one in order to be able to test). Maybe i will have to test the parameters of the RegisterTouch...() method, although I am sure it wont make a difference. Its good to know that those messages will be translated to normal mouse messages. Thanks for your support so far!
Kreatief
Posts
-
[Touchdisplay] Right mouseclick on CView not working -
[Touchdisplay] Right mouseclick on CView not workingHey, thanks for the reply. This gives me a good starting point. However, I cant seem to get it working. I registered the touch handling via
if (!RegisterTouchWindow())
in the overwritten OnCreate method of CMDIFrameWnd I defined the WM_TOUCH message:
#if(WINVER >= 0x0601)
ON_MESSAGE(WM_TOUCH, OnTouch)
#endif(I checked the winver, it is correct.) But I never get to the OnTouch method. Any advice? EDIT: Interestingly it works through remote-desktop from the tablet but not as a fat client installation. No idea why though...
-
[Touchdisplay] Right mouseclick on CView not workingHi, I have a CView and some objects on it with a right click behaviour, using overwritten method OnRButtonDown(UINT nFlags, CPoint point). But its not working on a windows8 tablet with touchdisplay (selecting object and keeping finger pressed for some seconds). Doubleclick and stuff is working, just not the right mouseclick. But its working in standard comboboxes. Are there any special events that I have to implement in order to catch the right mouseclick? Thank you!
-
Design of complex decission modulesHi, I am looking for a way to solve my problem in a proper way: I have a pool of objects as input (lets name them p) I have alot of different decission criterias (lets name them c) I now want to sort those p with weighted c to get the best decission about the sorting of p. I think about a system where c are objects derived from a base class (name it Criteria). I want to be able to weight those c in a way that I am not sure of yet. Maybe it would be good to create a directed graph with those weights and let a search algo like Dijkstra run over it and get back the best result. Sorry for the confusing description. I dont get it sorted in my brain ;) I thinkt I am not the first one with a problem like this and hopefully there are some design concepts/patterns to solve such a problem without using if-else. Another question: Is there some design concept where the system can selve learn from its results and maybe start weighting those c on its own, based on earlier results? I appreciate any input from you!
-
Protection of Windows for SendMessageanyone?
-
Protection of Windows for SendMessageHi, I know that it is possible to "protect" your application so that you can just see the top-level window of an app if you use Spy++ or similar. All child windows arent listed there (like Edit boxes, checkboxes etc). If I want to get the state of a checkbox, the normal Message BM_SETCHECK is not usable. What are the ways to protect the apps and is there a wor around to be able to send messages and get the state of a checkbox or read the text of an editbox? Thats what I used so far for nonprotected apps: #include "stdafx.h" using namespace std; #define TEXT_LENGTH 1024 char text[TEXT_LENGTH+1]; HWND hwndInfo = NULL; HWND hwndEdit = NULL; BOOL CALLBACK EnumChildWindowsProc(HWND hWnd, LPARAM lParam) { char pcControlClass[TEXT_LENGTH]; GetClassName(hWnd, pcControlClass, TEXT_LENGTH); if( ::strcmp(pcControlClass, "Edit") == 0 ) { TCHAR pcEditText[TEXT_LENGTH]; long len = SendMessage(hWnd, WM_GETTEXT, TEXT_LENGTH, (LPARAM)pcEditText); if( len != 0 ) { SendMessage(hWnd, WM_SETTEXT, TEXT_LENGTH, (LPARAM)"lala"); } return false; } return true; } BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { char pcWinTitle[TEXT_LENGTH]; if( !::GetWindow(hWnd, GW_OWNER) ) { ::GetWindowText(hWnd, pcWinTitle, TEXT_LENGTH); if( ::strcmp(pcWinTitle, "HookTest123") == 0 ) { EnumChildWindows(hWnd, EnumChildWindowsProc, (LPARAM)0); return false; } } return true; } int _tmain(int argc, _TCHAR* argv[]) { EnumWindows( EnumWindowsProc, (LPARAM)0); return 0; }
-
RS232 - Sending Data - Only 16Bytes allowed?!From germany? Nice, me too :-) No, the endpoint can handle more than 16 Bytes definetly. I managed to write a total simple communication class which can write more than 16 Bytes. And I cant find the difference between them. I dont know where to search, and what to search for. DKT
-
RS232 - Sending Data - Only 16Bytes allowed?!Hello, I am having troubles with sending data through RS232. I am using the class from Ramon de Klein: http://www.codeproject.com/system/serial.asp There I am working with the simple Serial Class (Overlapped). My problem is that I can only send 16 Byte all together. If I try to send more than 16 Byte, its sending an empty message and I get a NAK from the other side ( I monitored this with a monitoring tool). This is what the Overlapped structure is set to after sending data:
Internal 258 unsigned long InternalHigh 16 unsigned long Offset 0 unsigned long OffsetHigh 0 unsigned long Pointer 0x00000000 void * hEvent 0x00000780 void *
As you can see, InternalHigh is set to 16. I dont know why. I cant figure out why I am only allowed to send 16 Byte. The dwInQueue as well as the dwOutQueue is big enough to hold more data. The problem is that I absolutely have no clue where to search for that problem. Is there anything that restricts the number of bytes to send? Which codepart can be relevant for you? This the write method:LONG CSerial::Write (const void* pData, size_t iLen, DWORD* pdwWritten, LPOVERLAPPED lpOverlapped, DWORD dwTimeout) { // Check if time-outs are supported CheckRequirements(lpOverlapped,dwTimeout); // Overlapped operation should specify the pdwWritten variable _ASSERTE(!lpOverlapped || pdwWritten); // Reset error state m_lLastError = ERROR_SUCCESS; // Use our own variable for read count DWORD dwWritten; if (pdwWritten == 0) { pdwWritten = &dwWritten; } // Reset the number of bytes written *pdwWritten = 0; // Check if the device is open if (m_hFile == 0) { // Set the internal error code m_lLastError = ERROR_INVALID_HANDLE; // Issue an error and quit _RPTF0(_CRT_WARN,"CSerial::Write - Device is not opened\n"); return m_lLastError; } #ifndef SERIAL_NO_OVERLAPPED // Check if an overlapped structure has been specified if (!m_hevtOverlapped && (lpOverlapped || (dwTimeout != INFINITE))) { // Set the internal error code m_lLastError = ERROR_INVALID_FUNCTION; // Issue an error and quit _RPTF0(_CRT_WARN,"CSerial::Write - Overlapped I/O is disabled, specified parameters are illegal.\n"); return m_lLastError; } // Wait for the event to happen OVERLAPPED ovInternal; if (!lpOverlapped && m_hevtOverlapped) { // Setup our own overlapped structure memset(&ovInternal,0,sizeof(o
-
Length of VARIANT V_BSTROh perfect. It works now! BUT: While testing, I used a string that was 442 chars long, so not longer than those 500! And no, I couldnt easily convert the string to LPCSTR, cause the string is an own written class (not by me), but I found out that there is a c_str method in this class. And now, it works! Amazing. Thanks so much, this was a very clear answer, and I can learn alot from it, on how to code better! DKT
-
Length of VARIANT V_BSTRI checked the double zero, but it didnt make it better... Here some code: Function to convert String to widechar: OLECHAR* ViaExcelConnector::strToWc(const string &cnvrtData) const { OLECHAR cnvrt[500]; int i = 0; char cnvrtChr[500]; for(i=0; i
-
Length of VARIANT V_BSTRHmmm thats strange... If I use a direct string: V_BSTR(&v) = SysAllocString(OLESTR("blabla")); then, it works. Even if the "blabla" string is more than 500 chars long! If I use it the way I mentioned before, then it behaves strange: The first time it cuts some bytes off, the second time and so on, it works! If I put the same command twice, then it never works... It seems as if the memory management is totally shit! DKT
-
Length of VARIANT V_BSTRHi, I am dealing with OLE automation. Now: I have to convert a string to V_BSTR to use it with OLE. This string is really long. About 500 chars and more! If I convert it to V_BSTR, then it cuts after some hundred bytes (about 230). How can I avoid it? I use SysAllocStringLen to convert it, with this, normally, it should be allocated enough space for it. But it seems it doesnt care! VARIANT v1; V_VT(&v1) = VT_BSTR; V_BSTR(&v1) = SysAllocStringLen(strToWc(selStr), 1500); strToWc() is a method by me, which converts a string to widechar. This one works. I checked, and the string is complete! DKT
-
Starting macro from c++Hi, I am dealing with Excel Automation. I get most things working, but now I have a very strange behaviour: I created a big macro, which creates a pivot table from a normal table, and then makes a chart out of it. When I run the macro from the excel file, everything works! But, when I run the macro through a c++ program, it crashes. Here my C++ code: hr = CreateObject(OLESTR("Excel.Application"), &pdispApplication); V_VT(&v) = VT_BOOL; V_BOOL(&v) = TRUE; hr = Invoke(pdispApplication, DISPATCH_PROPERTYPUT, NULL, NULL, NULL, OLESTR("Visible"), TEXT("v"), v); hr = Invoke(pdispApplication, DISPATCH_PROPERTYGET, &vRet, NULL, NULL, OLESTR("WorkBooks"), NULL); pdispWorkbook = V_DISPATCH(&vRet); V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(OLESTR("C:\\Dokumente und Einstellungen\\geh\\Desktop\\Excel Tests\\Test02.xls")); hr = Invoke(pdispWorkbook, DISPATCH_METHOD, &vRet, NULL, NULL, OLESTR("Open"), TEXT("v"), v); V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(OLESTR("Test02.xls!Chart")); hr = Invoke(pdispApplication, DISPATCH_METHOD, &vRet, NULL, NULL, OLESTR("Run"), TEXT("v"), v); What it does: It creates the pivot table, and creates a new chart. But when trying to set the XValue or Value from a new series, it says: "The XValue-Propertie cant be set" Here the code snippet from the macro: Sheets.Add Charts.Add ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _ "Linie - Säule auf zwei Achsen" ActiveChart.SetSourceData Source:=Sheets("Tabelle3").Range("A1") Set st = ActiveChart.SeriesCollection.NewSeries With st .Name = "=""Anz. KLEs am Platz""" .XValues = "=Tabelle2!R4C3:R4C57" .Values = Values End With As I said, if run it directly from the xls file, it works! And yes, the table "Tabelle2" is there, and opened. If I put a "stop" before it, so that I can trace it, it looks totally equal! Wheres my problem? EDIT: I just solved it by using .XValues = Worksheets("Tabelle2").Range("A4:BP4") But I still would like to know where my problem was! DKT -- modified at 11:05 Monday 29th August, 2005
-
Excel Automationhttp://www.lordjoe.com/Java2Com/CPPCode.html[^] Check out the link, it uses the help file INVHelp.h Very easy to use! DKT
-
Reverse Engenieering SoftwareDisassemblers are used to show the machinecode of any programmers language. This machinecode is called Assembler, or short: ASM. Debuggers are used to trace the whole code at runtime. I think you know that from VC++ debugger. But the difference to other debuggers is: You trace, again, machincode, so ASM. Good debuggers: OllyDbg, Sice (softice) Good Disassembler: IDA, w32Dasm DKT
-
Listbox - How to keep an indexIf this is true for vectors, then i will give it a try with vectors! I hope this will work better. Thank you. DKT
-
Adding hexadecimal values in c++I think an integer in the form \x0D0 should do the job. EDIT: Just checked it! Do it like that: int whatever='\x20'; int whatever2='\x32'; whatever+=whatever2; Check for (decimal) 82, and you see its correct! DKT
-
Listbox - How to keep an indexWhat excatly do you mean by mapping the structure with the listbox text? I will work on that CMap class, and hope to find some useful information. Thanks for pushing me in the right direction, and it would be nice if you could explain me the question above! EDIT: If I am right, this class will connect an ID with another, chosable, ID. That seems to be like the SetItemData function for listbox entries, is that correct? What is more useful? I am using this function right now, and its eehm, yeah, like a little, not that fine, workaround for the problem... DKT
-
Listbox - How to keep an indexCause, if I delete the corresponding array item, all others will keep their index for the array, not like the listbox. If it would change its index just like the listbox does, there wouldnt be any problem! And I dont think that you can simply change the indizes of a structure array! Correct me if I am wrong. DKT
-
Listbox - How to keep an indexHi, i am using a listbox with several entries. At runtime I wanna delete an entry without losing the others indizes. The reason is: I am using an array of a structure, and every entry has its own structure. But, if I delete an entry, lets say, at the beginning, all others will change their index. This way I cant use this index as number for the structure array. I tried to do a little workaround with SetItemData, but thats some kinda too complicated. What can I do? Did I miss anything? One more thing, which may solve the problem too: How can i change the text of a Listbox item? I used to delete the item and insert it again,but that causes the same problems with indexing as mentioned above! DKT