002
23.06.2006, 14:08 Uhr
J-jayz-Z
Perl Crack ala Carte (Operator)
|
Ich poste einfach mal meinen kompletten Quelltext, weil ich es irgendwie nicht gebacken bekomme ...:
C++: |
#include <windows.h> #define ID_button 1 #define ID_textfield 2 #define ID_listbox 3 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT("HelloWin"); HWND hwnd; MSG msg; WNDCLASS wndclass;
wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIcon( NULL, IDI_HAND ); wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szAppName;
if(!RegisterClass(&wndclass)) { MessageBox( NULL, TEXT("Fehler, Programm benötigt UNICODE und somit mindestens Windows NT"), szAppName, MB_ICONERROR); return 0; }
hwnd = CreateWindow( szAppName, TEXT("Test"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL );
ShowWindow(hwnd, iCmdShow); UpdateWindow(hwnd);
while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; }
LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; RECT rect;
switch(message) { case WM_CREATE: HWND hwndButton; HWND hwndTextfield; HWND hwndList; HWND hwndStatic; hwndButton = CreateWindow( TEXT("Button"), TEXT("Send"), WS_CHILD | WS_VISIBLE | WS_BORDER, 0, 0, 100, 30, hwnd, (HMENU)ID_button, ((LPCREATESTRUCT) lParam)->hInstance, NULL);
hwndTextfield = CreateWindow( TEXT("edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL, 0, 30, 100, 20, hwnd, (HMENU)ID_textfield, ((LPCREATESTRUCT)lParam)->hInstance, NULL);
hwndList = CreateWindow( TEXT("listbox"), NULL, WS_CHILD | WS_VISIBLE | LBS_STANDARD, 0, 50, 100, 80, hwnd, (HMENU)ID_listbox, (HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE), NULL);
return 0; case WM_COMMAND: if(LOWORD(wParam) == ID_button) { char *name; int length; length = SendMessage(hwndTextfield, WM_GETTEXTLENGTH, 0, 0); name = (char*)calloc(length, sizeof(char)); SendMessage(hwndTextfield, WM_GETTEXT, 0, (LPARAM)name); SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)name); } return 0;
case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hwnd, message, wParam, lParam); }
|
Ich will einfach nur, das beim klicken auf "Send" der Inhalt aus dem Textfeld genommen wird und in der Liste erscheint ... -- perl -Mstrict -Mwarnings -e 'package blub; sub new { bless {} } sub bar {my $self=shift; $self->{bla}="66756e2d736f66742e6465"; return $self->{bla};} my $foo=blub->new();print "Hallo ";print pack("H*",$foo->bar()); print "\n"' |