Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
U

uus99

@uus99
About
Posts
44
Topics
19
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Slow performance with mixed assembly
    U uus99

    Hi, I wrote a program in Visual Studio 2005b2 (Winforms), but include many of my image processing algoritms written in unmanaged c++. These functions use SSE2, and array manipulations. However, compiling my new program (.Net) resulted in very poor performance, where the execution is so slow, compared to the same code when compiled in MFC. Why is that? I'm aware that .Net compiler generates MSIL, and it is compiled to native code on the fly during execution. Most articles online says that .Net code is slightly slower than pure code, but eventually the performance difference is too small to be noticed. In my case, the performance difference is big, and the program executes horribly! Am i doing something wrong? I thought my unmanaged code will be compiled as native code, while the others will be compiled as MSIL resulting in a mixed assembly, thereby maintaining my performance, but this is not the case. Any ideas? Also, i used #pragma unmanaged. Thanks,

    C / C++ / MFC csharp c++ visual-studio winforms data-structures

  • How to open file in own program?
    U uus99

    WHat about dialog based programs? My project is a dialog based project, and i wan to associate TIFF files so that it opens in my program.

    C / C++ / MFC tutorial question

  • How to open file in own program?
    U uus99

    Hi, once i associate the the file extension, which function will be called if i open the file in explorer? I mean, for example, my program is Program.exe, and the file is file.zzz. I associate the files *.zzz to my program, and if i open it in explorer, which function in my program will it be called?? OnOpen() etc?? Do i have to add an event handler? THanks, Usman

    C / C++ / MFC tutorial question

  • How to open file in own program?
    U uus99

    Hi, I have a file that i want to associate it with my program. Then, if i double click it in explorer, it should automatically open in my program. What event should i handle? How to do this? Usman

    C / C++ / MFC tutorial question

  • MFC dialog based application and command prompt
    U uus99

    You can show a console, by adding the following line in Post-Build in Project Properties (VC2003) or Project Settings Post-Build Step (VC6). editbin /SUBSYSTEM:CONSOLE "$(OUTDIR)"\ Where program name is the name of your final build exe. If i am building Notepad.exe, then it would be editbin /SUBSYSTEM:CONSOLE "$(OUTDIR)"\notepad.exe You can also call it from cmd.exe manually editbin /SUBSYSTEM:CONSOLE c:\programfiles\etc\etc\notepad.exe Usman

    C / C++ / MFC c++ help question

  • How to get AVI bit depth?
    U uus99

    Hi, i'm reading an AVI using Video for Windows VfW. Using AVIFILEINFO structure, i'm able to obtain the height, width etc. But how do i obtain the frame bitdepth(8-bit, 14,32 bit?)?

    C / C++ / MFC question tutorial

  • int, read from text file
    U uus99

    No header is required. Stdafx.h is sufficient i think. CFile is a class of MFC. Refer to MSDN

    C / C++ / MFC question

  • int, read from text file
    U uus99

    Try this, //File reading---- CFileException ex; //catch exceptions CFile myfile; //Open file myfile.Open("c:/b.txt", CFile::modeRead, &ex); //Get length int z=myfile.GetLength(); //create temp buffer with all data including line breaks char* data=new char[z]; //read data myfile.Read(data,z); //Extract only data, remove line breaks int* value=new int[z/3]; for(int i=0;i

    C / C++ / MFC question

  • Problem with GDI+ in Visual C++ 6.0
    U uus99

    Hello there, I'm using Visual C++ 6 with Platform SDK and trying to create a imaging program. The program is simple, where i the user can draw lines on a TIFF image. I'm using GDI+ for this purpose, but having one problem. The problem is that GDI+ just cannot draw on gray(8-bit)/black & white TIFF images or BMP for that matter. I dont know why. A simple test code is given below, void CGDIPlusDlg::OnButton8() { //gets current DC CDC *pDC=this->GetDC(); //gets Handle to DC HDC hdc=pDC->GetSafeHdc(); //Opens an image from disk Image img(L"c:\\mspaint.tif"); //target rectangle at coordinate 0,0 sizwe RectF r(0, 0, 100, 100); //Set graphics, and dest Graphics gr(hdc); RectF destRect(0, 0, 100, 100); //Draw original image-works fine gr.DrawImage(&img,destRect); //Create a blackpen (A,b,g,r), thickness 3 Pen blackPen(Color(255, 0, 0, 0), 3); //Start and end point PointF point1(0, 0); PointF point2(100.0f, 100.0f); //Draw line on image---doesnt work for BW images!! Graphics gr2(&img); gr2.DrawLine(&blackPen,point1,point2); RectF destRect2(100, 0, 100, 100); gr.DrawImage(&img,destRect2); } The image is created using MSPaint. Create a 100x100 image, draw something, and save as TIF. Save again by changing the image depth to black & white from the Image->Attributes menu. The program supposed to draw a diagonal line across the image, but it doest for the black&white version of tif. So, my problem is how to overcome this? Or, how can i programmatically convert a BW TIFF to color and work on it using GDI+? Oh yeah, can anyone try if this code works fine in C# or managed C++? Thanks, Usman

    C / C++ / MFC c++ graphics question csharp winforms

  • How to release HDC ?
    U uus99

    I have a function that performs some drawing according to the bitdepth of the screen. The function is called in a loop continuously. The problem is, after a while it crashes. I have narrowed it down the problem to the HDC not being released. How can i release it? void Plot() { //Obtain current screen depth HDC hdc = ::GetDC(NULL); int screendepth=GetDeviceCaps(hdc, BITSPIXEL); //do something here according to the current bitdepth //how to release here? }

    C / C++ / MFC question graphics help tutorial announcement

  • Converting Buffer image to DC
    U uus99

    Hi, I have a framegrabber that snaps an image and sends it to a memory buffer at m_pBuffer (type of LPVOID). I do not know the content structure of the m_pBuffer, but i know i contains a 24bit RGB Bitmap. Doing the operation below (SetDIBitsToDevice), allows me to plot the contents to the screen. I want to transfer the contents of m_pBuffer to my own device context (CDC myDC), so that i can use GetBitmapBits and manipulate the date prior to plotting on to the screen. Can anyway point me on how to do this? Do i use SetDIBits, if so, how? CClientDC dc(this); if ( m_pBuffer == NULL ) return ; pBitmapInfoRGB24->bmiHeader.biWidth = ImageSizeX ; pBitmapInfoRGB24->bmiHeader.biHeight = - ImageSizeY; // ------------------------------------------------------------------------ // Transfer the image to display // ------------------------------------------------------------------------ SetDIBitsToDevice ( dc.GetSafeHdc(), 22, 25 , ImageSizeX, ImageSizeY , 0, 0, 0, ImageSizeY , &m_pBuffer , pBitmapInfoRGB24 , DIB_RGB_COLORS); bOnGoingRefresh = false ;

    C / C++ / MFC graphics performance tutorial question

  • How to change Menu caption dynamically?
    U uus99

    I tried the samething with SDI app. And it works. But it doesnt in my dialog based app. Anyone?

    C / C++ / MFC question tutorial

  • How to change Menu caption dynamically?
    U uus99

    I know that, i was testing if my Exit menu item will change it's caption. It was a test app, which does nothing. Just a menu with File>Exit. Clicking the Exit does not execute any function. So i just wanted to test if the caption changes, but it doesnt! Why?

    C / C++ / MFC question tutorial

  • How to change Menu caption dynamically?
    U uus99

    I tried that, but i doesnt work. I'm using VC++6 with SP5 and my program is a dialog based program. void CTestUImageDlg::OnUpdateFileExit(CCmdUI* pCmdUI) { pCmdUI->SetText("Start"); } Nothing happens! Why??!!

    C / C++ / MFC question tutorial

  • How to change Menu caption dynamically?
    U uus99

    I have a menu "Options" with one submenu "Start" Options>Start How can i change the caption of "Start" to "Stop" when i click the menu?

    C / C++ / MFC question tutorial

  • How to delete *ptr correctly?
    U uus99

    Thanks! The initialization of those pointers to Null solved my problem right away! I never knew i had to do that! Thanks again!

    C / C++ / MFC c++ debugging help tutorial question

  • How to delete *ptr correctly?
    U uus99

    Yes, you are right, i realized it. Even after i corrected that, there is still the same problem. Why?

    C / C++ / MFC c++ debugging help tutorial question

  • How to delete *ptr correctly?
    U uus99

    I made a very simple class, and when the default destructor is called, i get a debug assertion failure. (i'm using VC++ SP5) if i call a function like this void Testfunction() { uImage test; test.Create(100); } the function exits properly, with the default destructor deleting the arrays successfully, however,if i call a function like this, that is without allocating the arrays, void Testfunction() { uImage test; } The function exits with a Debug Assertion Failure, _CrtIsValidHeapPointer What i'm confused is that, i'm trying to do cleanup in the destructor by deleting all the dynamic arrays. Although i havent created the arrays, there should be no problem coz i checked whether the pointers are NULL or not (when performing delete). So, why is there a debug assertion? My class header is #ifndef UIMAGE_H #define UIMAGE_H class uImage { private: int *R; int *G; int *B; public: uImage(); ~uImage(); void Create(int x); }; #endif My Class is #include "StdAfx.h" #include "uImage.h" uImage::uImage() { } uImage::~uImage() { if(R!=NULL) delete R; if(G!=NULL) delete G; if(B!=NULL) delete B; } void uImage::Create(int x) { R=new int[x]; G=new int[x]; B=new int[x]; }

    C / C++ / MFC c++ debugging help tutorial question

  • Program exited with code 2 (0x02). What does it mean?
    U uus99

    Well, i wrote the program, and it spawns an additional 1 thread. I didnt return any value when i exit the thread, and that's why i'm wondering why it returns a value of 2.

    C / C++ / MFC debugging question

  • Can i redirect the ouput of Debug window to a Text file?
    U uus99

    My program calls many functions and interates in many loops. To debug the program, i've placed TRACE calls all over the place, but it seems, when the program runs, not all the TRACE outputs are displayed, they are truncated. I guess there isnt enought place/memory for the debug window, how can i redirect it to a text file? Thx.

    C / C++ / MFC debugging question performance
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups