Dancho

Member
  • Content count

    21
  • Joined

  • Last visited

Community Reputation

151 Neutral

About Dancho

  • Rank
    Member
  1. Assembly Language Problem

    ok,2 things... 1.) when you download latest fasm package you receive pdf document about assembly and fasm programming , study it and you will understand what is section and @@ and etc ... 2.) for windows programming APIs download some PSDK and check console func you are using here This code is very simple and you should really understand it before going further...
  2. Assembly Language Problem

    ok try this snipet and study it for a while, see where you were wrong... format PE console entry cmain include 'win32ax.inc' section '.code' code readable executable cmain: invoke GetStdHandle,STD_INPUT_HANDLE mov [inHandle],eax invoke GetStdHandle,STD_OUTPUT_HANDLE mov [outHandle],eax ; @@: invoke ReadConsole,[inHandle],buffer,MAX_PATH,cRead,0 sub [cRead],2 .if [cRead]=1 stdcall PrintMessage,<'Going Out Now',13,10,0>,15 jmp @f .else stdcall PrintMessage,<'Write Only 1 Char',13,10,0>,19 invoke RtlZeroMemory,buffer,MAX_PATH jmp @b .endif @@: invoke ExitProcess,0 proc PrintMessage uses esi edi ebx,text,len local cWritten:DWORD invoke WriteConsole,[outHandle],[text],[len],addr cWritten,0 xor eax,eax ret endp section '.data' data readable writeable inHandle dd 0 outHandle dd 0 cRead dd 0 buffer rb MAX_PATH section '.idata' import data readable library kernel32,'kernel32.dll' include 'api\kernel32.inc'
  3. easy to learn gui written in c

    check theForger's Win32 API Tutorial,they are covering dialog boxes among other things...
  4. SSE resources

    check this : Software optimization resources by Agner
  5. [Assembly] String and Struct issues

    well,if you want to copy string "Bar" to the element descrip then you can do something like this... and btw you cant do direct mem to mem copy in asm... .686 .model flat,stdcall option casemap:none include kernel32.inc includelib kernel32.lib Room Struct descrip BYTE 100 DUP (?) east DWORD ? Room ENDS .data testroom Room <"A Simple Room",10> bar byte "Bar",0 .data? .code start: mov ecx,lengthof bar mov esi,offset bar mov edi,offset testroom.descrip rep movsb invoke ExitProcess,0 end start btw check this forum
  6. Assembly in Windows XP

    Another great ide is:RadASM
  7. C - For loops not working?

    check Pelles C http://smorgasbordet.com/pellesc/ you can write loops like that without problems...
  8. Password checking method

    @ToohrVyk Isnt your syntax for fputs wrong ? I belive this is correct: int fputs(const char * string, FILE * stream); String is first and stream second argument...
  9. Assembly language

    popular assembly communities with friendly members are: The Masm Forum - http://www.masm32.com/board/index.php ASM Community - http://www.asmcommunity.net/ if you want to learn something about assembly programming check it...
  10. hm, the debug version works when I declare HeightMap object as global, like this : #include <iostream> using namespace std; class HeightMap { static const int width=1024; static const int height=1024; public: char map[width][height]; }; HeightMap hm; int main() { return 0; } well,dont know what to think now :)
  11. @Antheus thx, I also think that dynamic allocation is right way to do this,but I was just wondering why release version runs and debug crash and why MinGW works where VC++ doesnt...
  12. @ToohrVyk thx for explanation...
  13. so I have this simple code ( just to demonstrate problem ) #include <iostream> using namespace std; class HeightMap { static const int width=1024; static const int height=1024; public: char map[width][height]; }; int main() { HeightMap hm; return 0; } and it compiles without errors with Visual C++ 2005 EE ( debug and release version ) but it crashes when I try to start debug version , but release version starts normally. On the other hand latest Code::Blocks 8.02 also compile fine and runs debug&release version without crashes. If someone could explain this I would be very grateful. thx
  14. Hi all, The problem is simple but solution is beyond my current knowledge so I'm asking for some help... This little snippet is just for example,it is classic win32+opengl beginner combo,compile/run it and small blue triangle wii be shown it,and then start your favorite screensaver and cancel it and small blue triangle is gone,i.e it isnt redraw again... Now Im not asking how to prevent screensaver to start,I know that,just how to force redraw of the window... As you can see I attempt something with wm_paint message but it isnt working,so Im little lost now what to do... thx all #include <windows.h> #include <gl/gl.h> #include <gl/glu.h> LRESULT CALLBACK win_proc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam); bool register_window(HINSTANCE hinstance); HWND create_window(HINSTANCE hinstance); void setup_pfd(HDC hdc); void initgl(); void render_triangle(); const char app_class_name[]="OpenGL Class"; const char app_win_name[]="OpenGL Window"; const int WINDOW_WIDTH=800; const int WINDOW_HEIGHT=600; HDC g_hdc=NULL; HGLRC g_hrc=NULL; int WINAPI WinMain(HINSTANCE hIns,HINSTANCE hPins,LPSTR cmd,int show) { HWND hwnd=NULL; MSG msg={0}; if(!register_window(hIns)) exit(EXIT_FAILURE); hwnd=create_window(hIns); if(hwnd==NULL) exit(EXIT_FAILURE); ShowWindow(hwnd,SW_SHOW); UpdateWindow(hwnd); bool running=true; initgl(); while(running) { if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if(msg.message==WM_QUIT) running=false; TranslateMessage(&msg); DispatchMessage(&msg); } render_triangle(); SwapBuffers(g_hdc); } return (int)msg.wParam; } LRESULT CALLBACK win_proc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { static HDC hdc=NULL; PAINTSTRUCT ps={0}; switch(msg) { case WM_CREATE: hdc=GetDC(hWnd); g_hdc=hdc; setup_pfd(g_hdc); g_hrc=wglCreateContext(g_hdc); wglMakeCurrent(g_hdc,g_hrc); break; case WM_CLOSE: case WM_DESTROY: case WM_QUIT: wglMakeCurrent(g_hdc,NULL); wglDeleteContext(g_hrc); PostQuitMessage(0); break; case WM_PAINT: BeginPaint(hWnd,&ps); render_triangle(); EndPaint(hWnd,&ps); break; } return DefWindowProc(hWnd,msg,wParam,lParam); } void initgl() { glClearColor(0.0,0.0,0.0,0.0); glViewport(0,0,WINDOW_WIDTH,WINDOW_HEIGHT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0,(GLdouble)WINDOW_WIDTH,0.0,(GLdouble)WINDOW_HEIGHT); glMatrixMode(GL_MODELVIEW); } void render_triangle() { glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); glTranslatef(400,300,0.0); glBegin(GL_TRIANGLES); glColor3f(0.0,0.0,1.0); glVertex2i(50,0); glVertex2i(25,25); glVertex2i(0,0); glEnd(); } bool register_window(HINSTANCE hinstance) { WNDCLASSEX wc; memset(&wc,0,sizeof(WNDCLASSEX)); wc.cbSize=sizeof(WNDCLASSEX); wc.style=CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc=win_proc; wc.cbClsExtra=0; wc.cbWndExtra=0; wc.hInstance=hinstance; wc.hIcon=LoadIcon(NULL,IDI_APPLICATION); wc.hCursor=LoadCursor(NULL,IDC_ARROW); wc.hbrBackground=NULL; wc.lpszMenuName=NULL; wc.lpszClassName=app_class_name; wc.hIconSm=LoadIcon(NULL,IDI_APPLICATION); if(!RegisterClassEx(&wc)) { MessageBox(0,"Window Registration Failed","Error",MB_ICONERROR | MB_OK); return false; } return true; } HWND create_window(HINSTANCE hinstance) { HWND hwnd=NULL; RECT window_rect={0}; DWORD exstyle=0; DWORD style=0; exstyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; style=WS_OVERLAPPEDWINDOW ^ WS_MAXIMIZEBOX; window_rect.left=0; window_rect.right=WINDOW_WIDTH; window_rect.top=0; window_rect.bottom=WINDOW_HEIGHT; AdjustWindowRectEx(&window_rect,style,FALSE,exstyle); hwnd=CreateWindowEx(exstyle, app_class_name, app_win_name, style, CW_USEDEFAULT, CW_USEDEFAULT, window_rect.right-window_rect.left, window_rect.bottom-window_rect.top, 0, 0, hinstance, NULL); return hwnd; } void setup_pfd(HDC hdc) { PIXELFORMATDESCRIPTOR pfd; int pixel_format; memset(&pfd,0,sizeof(PIXELFORMATDESCRIPTOR)); pfd.nSize=sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion=1; pfd.dwFlags=PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType=PFD_TYPE_RGBA; pfd.cColorBits=32; pfd.cDepthBits=24; pfd.iLayerType=PFD_MAIN_PLANE; pixel_format=ChoosePixelFormat(hdc,&pfd); SetPixelFormat(hdc,pixel_format,&pfd); }
  15. C compiler

    try Pelles C... http://smorgasbordet.com/pellesc/