從網路上找的...


Joh 發表在 痞客邦 留言(0) 人氣()

1. 在Create() 時的Style要加上 BS_OWNERDRAW

2. 在Class中加上 virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);

Joh 發表在 痞客邦 留言(0) 人氣()

用winsock2.h 來建立raw socket一直失敗

後來上網爬文後才發現...

Joh 發表在 痞客邦 留言(0) 人氣()

#include <windows.h>

#pragma comment( lib, "gdiplus.lib" )
#include <gdiplus.h>

using namespace Gdiplus;

int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
   UINT  num = 0;          // number of image encoders
   UINT  size = 0;         // size of the image encoder array in bytes

   ImageCodecInfo* pImageCodecInfo = NULL;

   GetImageEncodersSize(&num, &size);
   if(size == 0)
      return -1;  // Failure

   pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
   if(pImageCodecInfo == NULL)
      return -1;  // Failure

   GetImageEncoders(num, size, pImageCodecInfo);

   for(UINT j = 0; j < num; ++j)
   {
      if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
      {
         *pClsid = pImageCodecInfo[j].Clsid;
         free(pImageCodecInfo);
         return j;  // Success
      }   
   }

   free(pImageCodecInfo);
   return -1;  // Failure
}

void Filter( Bitmap* src, Bitmap* dst )
{
    int            w, h;
    w = src->GetWidth();
    h = src->GetHeight();

    for( int y=0; y<h; y++ ) {
        for( int x=0; x<w; x++ ) {
            Color c;
            c = src->GetPixel( x, y );

            // do something interesting here!
       
            dst->SetPixel( x, y, c );
        }
    }
}

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR sCmdLine, int nCmdShow )
{
    GdiplusStartupInput gdiplusStartupInput;
    ULONG_PTR gdiplusToken;
    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

    Bitmap*    pBitmapIn = new Bitmap( L"input.jpg" );

    Bitmap*    pBitmapOut = new Bitmap( pBitmapIn->GetWidth(), pBitmapIn->GetHeight(), PixelFormat32bppRGB );

    Filter( pBitmapIn, pBitmapOut );

    CLSID   encoderClsid;
    GetEncoderClsid(L"image/jpg", &encoderClsid);
    pBitmapOut->Save( L"output.jpg", &encoderClsid, 0 );

    GdiplusShutdown(gdiplusToken);
    return 0;
}

Joh 發表在 痞客邦 留言(0) 人氣()

 

LPPICTURE gpPicture;

Joh 發表在 痞客邦 留言(0) 人氣()

簡單小記一下

 

Joh 發表在 痞客邦 留言(0) 人氣()

1. 先要有 webbrowser2.cpp/.h 檔

 

Joh 發表在 痞客邦 留言(0) 人氣()

這篇也是寫給我自已看的...

 

Joh 發表在 痞客邦 留言(1) 人氣()

跟 c++ 比較不一樣 QQ"

或許是我對Java不了解 ~ 應該還有別的用法

Joh 發表在 痞客邦 留言(0) 人氣()

這也是寫給我自已看的 XDD

 

Joh 發表在 痞客邦 留言(0) 人氣()

1 23