Zeblar Nagrim

Members
  • Content count

    531
  • Joined

  • Last visited

Community Reputation

150 Neutral

About Zeblar Nagrim

  • Rank
    Advanced Member
  1. WM_USER

    Thank you AP! Your solution worked perfectly :)
  2. WM_USER

    No I need to send a float value. If it was a integer, I could simply pass it by value as the LPARAM.
  3. WM_USER

    Thanks filip! I think I must try to allocate the memory with GlobalAlloc then and pass over.
  4. WM_USER

    Hi! Im trying to send over the value of a float variable from one application to another. The Win32 application who send the message: float* g_pfTest = new float; <- global pointer *g_pfTest = 22.4; <- just a test value SendMessage(g_hwndOtherProgram, WM_USER+1, (WPARAM) 0, (LPARAM) g_pfTest ); In the Win32 applications Winproc that gets the message: switch (message) { case WM_USER+1: float t = *(float*) lParam; char text[40]; sprintf(text, "%0.3f", (float) t); MessageBox(hwnd, text, 0, 0); break; } The messagebox print "0.0", that isn't the correct value sent. Anyone know why?
  5. Is it possible to get a pixel from a window not visible in windows? Like a window being hidden behind another one. Is the graphic updated but not rendered so can I get the pixels any how?
  6. I LOVE THE CHRISTMAS THEME

    I like it :) Very nice christmas feeling.
  7. KOCOS WANTS MAKE MUSIC FOR YOU

    Sorry I don't have MSN :( What is it you want to discuss? You can send me a email: my adress is zeblar@zeropointgameplay.com.
  8. KOCOS WANTS MAKE MUSIC FOR YOU

    Vert nice stuff! I hope you get a well paid job as a music artist. Your songs are great.
  9. Ico processors

    You can save images as icon files in Visual Studio. Just load the bitmap image and save as icon...
  10. Help me translate a _asm function to c

    Quote:Original post by kevmo Quote:It seems that there should be more calls/registers/variables That would be done by the C function calling standards, this looks like C/C++ code with embedded assembly (only not in the gcc way). Here is roughly C code to do the same thing (sorry if there are bugs) unsigned short get_svalue(unsigned char k) { unsigned int tempval; tempval = *((unsigned int*)wordval); tempval = (tempval << k)>>16; if (!(tempval & (1<<(k-2)))) tempval += start_neg_pow2[k]; return tempval; } The assembly seems a little wacky and doesn't seem to do what the comment says it will do: it looks like it throws away the least significant k bits, and adds some power of two from a precomputed array if the (k-1)th bit isn't 1. You might be better off finding a different source of the JPEG decoding algorithm (one that doesn't have inline assembly). IIRC, modern compilers are smart enough that it is rarely necessary to include inline assembly, as it does not offer much performance gain, and mainly serves just to obsfucate the code. Thanks! With smaller adjustment that code works :)
  11. Help me translate a _asm function to c

    It must compile on GCC.
  12. Help me translate a _asm function to c

    No :) It's for decoding the jpeg format.
  13. I need to translate some _asm code to equivalent C/C++ code. As you might guess I have not written the code :) #define BYTE unsigned char #define SDWORD signed int DWORD wordval ; // k>0 always // Takes k bits out of the BIT stream (wordval), and makes them a signed value SWORD get_svalue(BYTE k) { _asm { xor ecx, ecx mov cl,k mov eax,[wordval] shl eax,cl shr eax, 16 dec cl bt eax,ecx jc end_macro signed_value:inc cl mov ebx,[start_neg_pow2] add ax,word ptr [ebx+ecx*2] end_macro: } }
  14. Frequency analysation

    Thanks Frunny! Your approch was very good! A real speed boost! I get a time reduction from 20 sek to 1.8 sek :) And a memory reduction about 32 meg :)
  15. I'm writing a small program for creating a 8-bit palett from a 24 bit bitmap... I'm trying to find all unique colors AND find out which 256 colors that are most of in the bitmap (ie. finding the frequency of colors). This process is very slow and I need to do it in a more efficient way. Here is the critical code, please tell me how I can do this in better (right now 100 call to this function takes about 20 sek on my AMD Athlon XP 1700+). int nyanses = 16777215; void analysePixels() { const int pixels = width*height; unsigned int r,g,b,color_key,freq,antal=0,oka=0,i; // Skapa en frekvenslista på alla färger. for(i=0; i<pixels; i++) { r = (unsigned char)pData[oka]; g = (unsigned char)pData[oka+1]; b = (unsigned char)pData[oka+2]; oka+=3; r <<= 16; g <<= 8; color_key = r+g+b; freq = colorfreq[color_key] + 1; colorfreq[color_key] = freq; } // Se hur ofta varje färg förekommer. for(i=0; i<max_nyanses; i++) { if(colorfreq[i] != 0) { sortdata[antal].freq = colorfreq[i]; sortdata[antal++].nyans = i; colorfreq[i] = 0; // tvätta bufferten } } qsort(sortdata, antal, sizeof(DATA), SortCB); }