|
Hi,
Can anyone help me here ?
I would really appreciate getting ideas for my problem.
-- Amit.
|
|
|
|
|
Does anyone know what DLL the image of the standard image list IDB_VIEW_SMALL_COLOR is stored in? You can see some of it in this screenshot: http://www.airwebreathe.org.uk/IDB_VIEW_SMALL_COLOR.png[^]. I might expect it to be in comctl32.dll with other common image lists... but it's not - only the old 4-bit version of the image.
This is all helping the development of Wine (windows apps running on linux).
Joel Holdsworth
|
|
|
|
|
hi..
my current problem is i have message keep coming to my local system port from one of my networked computer..
that is through socket programming(using udp).. and the application which im running in my system is win32 not mfc based...
and my project doesn't allow me to use mfc (might sound strange.. where cAsynchronous class is the only solution for an asynchronous UDP socket, i googled so far..).. and if there is a way to read incoming message (asynchronously and doesn't block my execution..so that i run the rest of my processes which include my menu handling, and blah, blah, blah, is there is a message of some type i should read it as it comes.. otherwise do my rest of the processess)....
previously just to recieve some msg outside mfc using udp i worked with recievefrom and other recieve functions that come with udp socket class members.. (and i even don't need the need to notify the incoming message thats why i went to udp not tcp..)
so finally what i need is just recieve message buffer from my local port.. and my work is done...
|
|
|
|
|
I'd have a look at the following article:
http://www.flounder.com/kb192570.htm[^]
Basically - don;t touch MFC's socket objects with a barge pole - put socket code in a different thread, and post messages to your main UI thread.
Enjoy the read - and look at the other essays on that site.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hello all!
I use the visual c++. I got this error: fatal error C1852: 'Release\Autorun.pch' is not a valid precompiled header file
The pch creating when the compile progress,but when the compile complete then the pch file deleting.
Thanks for all helps!!
|
|
|
|
|
Have you tried a "rebuild all"?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
Please if you can advise on following questions on integration with QuickBooks.
1. I need to connect to QuickBooks database. How can I connect and retrieve data from QuickBooks?
2. What type of connection do you use to connect to database?
3. Is there some tool that makes it easier?
Please answer on any questions of this, if you have programmed with QuickBooks.
Thanks in advance
John T.
|
|
|
|
|
Don't spam the forums. You should choose one forum and ask your question on the one only. That's in the rules.
|
|
|
|
|
ODS_HOTLIGHT 's not work with CListBox. Why? How to solve this?
|
|
|
|
|
I don't think the list box control has "hot track" features (correct me if i am wrong). Try using a list view (CListCtrl / SysListView32) instead, or use WM_MOUSEMOVE and TrackMouseEvent[^] to add this feature yourself. Shouldn't be that complicated.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I'm sorry, but i have no idea about this. This's ListBox. How to get the item that mouse 's hover with TrackMouseEvent()?
|
|
|
|
|
Well, you don't get that item with TrackMouseEvent, what you can do is handling WM_MOUSEMOVE, you can find the item the mouse is over using ItemFromPoint[^], and you use TrackMouseEvent to know when the mouse leaves since by default you get no message whatsoever about that. But to save yourself all the trouble figuring this out, you should really consider CListCtrl[^] instead, just like Iain suggested too.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
|
Hello,
I would like to emit the lable addresses from a bit of inline assembly code into a branch table but I could not figure out how to do it.
I would say it should look something like this. At least the compiler emits something like this for a switch statement. I am using visual studio 2005.
__asm
{
mov eax,BRANCHTABLE
mov ecx,"Number between 0 and N"
jmp [eax+ecx*4]
BRANCHTABLE
&LABLE0
&LABLE1
&LABLE2
...
&LABLEN
LABLE0:
...
LABLE1:
...
LABLE2:
...
...
LABLEN
}
Thanks
|
|
|
|
|
In MASM, possibly - but in inline assembly, you can't use operators such as & and you can't declare initialised data (which is what you're doing). I really don't know how you'd go about that. Maybe replace hte branchtable by a switch statement with interspersed inline assembly?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Remco,
I created this little inline assembly sample for you. It loads the addresses of code labels into a jump table and allows you to jump to the offset based on a user choice. I commented each line.
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
#pragma pack (1)
unsigned long table[3] = {0};
#pragma pack(pop)
char szError[] = "Invalid choice.\n";
char szPrompt[] = "Enter a number between 1 and 3:\n";
char szNotify[] = "You entered jump number: %d";
char szFmt[] = "%d";
int iChoice =0;
int iSizeArray = (sizeof(table) / sizeof(table[0]));
__asm
{
lea esi, table ;Load address of table into esi
mov edx, DWORD PTR jump1 ;Move address of jump1 into edx
mov [esi], edx ;Move edx into table[0]
add esi, 4 ;Increment esi by size of unsigned long
mov edx, DWORD PTR jump2 ;Move address of jump2 into edx
mov [esi], edx ;Move edx into table[1]
add esi, 4 ;Increment esi by size of unsigned long
mov edx, DWORD PTR jump3 ;Move address of jump3 into edx
mov [esi], edx ;Move edx into table[2]
lea eax, szPrompt ;Load effective address of prompt
push eax ;push eax onto stack
#ifdef _DLL ;Are we dynamically linked to C runtime?
call DWORD PTR printf ;Call dynamic linked printf
#else
call printf ;Call static linked printf
#endif
add esp, 4 ;adjust stack pointer because we pushed eax
lea eax, iChoice ;Load effective address of iChoice
push eax ;Push it onto the stack
lea ebx, szFmt ;Load effective address of fmt
push ebx ;Push it on the stack
#ifdef _DLL ;Are we dynamically linked to C runtime?
call DWORD PTR scanf ;Call dynamic linked scanf
#else
call scanf ;Call static linked scanf
#endif
add esp, 8 ;adjust stack pointer because we pushed eax and ebx
mov eax, iChoice ;Move iChoice value into eax
mov ebx, iSizeArray ;Move the size of our array into ebx
cmp eax, ebx ;compare
ja error ;Jump to the error lable if iChoice is larger than table array
dec eax ;Decrement iChoice by 1 because the table is zero based array
lea esi, table ;Load address of table into esi
mov eax,[esi + 4*eax] ;Move value of table array onto eax by calculating offset
jmp eax ;Jump to address stored in eax
jump1:
mov eax, 1 ;Move number 1 into eax
jmp notify ;Absolute jump to notify label
jump2:
mov eax, 2 ;Move number 1 into eax
jmp notify ;Absolute jump to notify label
jump3:
mov eax, 3 ;Move number 1 into eax
jmp notify ;Absolute jump to notify label
error:
lea eax, szError ;Load effective address of error
push eax ;push eax onto stack
#ifdef _DLL ;Are we dynamically linked to C runtime?
call DWORD PTR printf ;Call dynamic linked printf
#else
call printf ;Call static linked printf
#endif
add esp, 4 ;adjust stack pointer because we pushed eax
jmp end ;Absolute jump to end label
notify:
push eax
lea ebx, szNotify ;Load effective address of notify
push ebx
#ifdef _DLL ;Are we dynamically linked to C runtime?
call DWORD PTR printf ;Call dynamic linked printf
#else
call scanf ;Call static linked printf
#endif
add esp, 8 ;adjust stack pointer because we pushed eax and ebx
end:
}
return 0;
}
Best Wishes,
-David Delaune
|
|
|
|
|
Oooh - nice. I'd wondered if there was a way to create the jump table as a C variable, but hadn't thought of initialising it in assembly code.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello Stuart and David,
Thank you for your replies. Both solutions given are practical I think. I intended to use the branch table inside a time ciritcal part of my ray-tracer (ray vs axis aligned bounding box intersection test). I am building a stream ray-tracer using the sse ALU processing four rays in parallel. But the number of rays to process is not always a multiple of four to process the last 1,2 or 3 rays I thought to use a branch table. But I think I will make a funciton one for each case and use a switch statement ouside of the filter functions making the code easier to read and the c++ compiler does emit the code I would like.
Thank you for your help!!
|
|
|
|
|
A lot of jumps, and certainly those through a jump table, introduce a hickup in the instruction flow, as they are not predictable at all; so I'd rather avoid them.
assuming lots of rays I would take a different approach: if not a multiple of four, calculate one of the rays multiple times, e.g. duplicate the last ray one to three times so the number always is a multiple of 4. That probably will be simpler and may be faster.
|
|
|
|
|
Yes conditional branches can be expensive causing pipeline stalls. But in my implementation using streams of rays there is only one hard to predict branch and that branch is only taken once per processed stream so it is not really that important. But a c++/assembly mix looks alittle bit messy. Thats why I removed the branch table from my inline assembly function to improve code readability at the expense of code size. Expanding the number of rays per stream to a multiple of four is for me not an option because rays are partitioned in place. Meaning that the filtered stream or output stream should be of the same length compared to the input stream.
Thanks
|
|
|
|
|
I forgot to mention one technique I often use in cases like this, where the expensive jump is taken only once (upon entry); I'll describe it in pseudo-code, it basically is a loop unroll by 4:
switch(count%4) {
case 0:
goto case1;
case 1:
goto case2;
case 2:
goto case3;
case 3:
count-=4;
if (count>0) goto case0;
}
You can do this in any language, with a switch or with labels and jumps (and if the language allows fall-through, you may skip most of the goto's). In assembly, you would still need labels.
|
|
|
|
|
Hello,
I placed a break in the function OnKeyDown() of a class derived from CRichEditCtrl. But when I press F5 and debug the code the code doesnt proceed further but when I remove the break in the fucntion the code goes ahead . Ith this I am not able debug the OnKeyDown.
What should be done ?
Pritha
|
|
|
|
|
prithaa wrote: But when I press F5 and debug the code the code doesnt proceed further
Any further than what?
A breakpoint is meant to stop the code - you then have the option of what to do to make the execution progress.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for your reply
But when I press F5 the code goes further that is the cursor moves ahead but the the action doesnt reflect in the execution like suppose after pressing a right arrow key I want the cursor to move further on the dialog then the cursor doesnt move on the dialog. whereas if I remove the break in the OnkeyDown then cursor moves in the dialog.
I hope the question is clear.
Pritha
|
|
|
|
|
Well, if I've understood you correctly, that's because the breakpoint keeps on breaking - every time you hit OnKeyDown
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|