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
I

Indrawati

@Indrawati
About
Posts
61
Topics
46
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Windows question - efficient way to write a text on a loaded bitmap?
    I Indrawati

    Hi Let's say I have a pointer to a BITMAPINFO structure, and the structure holds information about an RGB bitmap in memory. Is there a way for me to directly write some string on top of the bitmap? Currently I do it like this: HDC hDC = CreateCompatibleDC(NULL); void *pDIB; HBITMAP hBmp = CreateDIBSection(hDC, pBmpInfo, DIB_RGB_COLORS, &pDIB, NULL, NULL); //pBmpInfo in of type BITMAPINFO* memcpy(pDIB, pData, iWidth * iHeight * 3); //iWidth and iHeight are the width and height of the image, respectively, and pData is a pointer to the bitmap's pixel values, multiplied by 3 because it's RGB SelectObject(hDC, hBmp); DrawText(hDC, "This is a test", strlen(cstrStatus), &CRect(5, 5, iWidth, iHeight), DT_LEFT); memcpy(pData, pDIB, iWidth*iHeight*3); DeleteObject(hBmp); DeleteDC(hDC); So basically I first copy the bitmap's pixel values to a buffer created using CreateDIBSection, write the text on the DIB, and copy the DIB pixel values back to the original bitmap pixels' location. Is there a more efficient way to do this without copying the pixel values back and forth between the two buffers (something like writing the text directly to pData)? Due to the way the system is designed, my function must work on preloaded BITMAPINFO* input that resides in memory, not bitmap image files or other types of input. And because my system needs all the speed it can get, any tips on how to make the above code faster will be greatly appreciated. Thanks!

    C / C++ / MFC performance question graphics tutorial

  • C++ debuggin question - detect change in variable?
    I Indrawati

    Hi I have a short question about debugging in C++. Let's say I have a member variable that rarely changes, and in my program I suspect there's an invalid modification made to this variable that causes my program to crash. Is there a way to set up a debugger in such a way that it will trap when the variable is changed? Simple text find in the source files won't do, since more complex circumstances (e.g. int tmp[100]; memcpy(tmp, some_buffer, 101*sizeof(int) /*oooops*/); ) MAY also change the value of the variable if it's located right after tmp[99], and these kinds of error won't be detected by source files text find. Thanks!

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

  • Open an instance of notepad with VC++ 6?
    I Indrawati

    Hi Is there a way for me to open an instance of notepad programmatically using VC++ 6? I've tried system("Notepad ") but it also open a DOS prompt along with Notepad, which is not what I want. Is there any other way to do this? BTW, I also want my app to still be responsive to user input while the notepad is open. Thanks!

    C / C++ / MFC c++ mobile question

  • Directshow - can a filter detect that the user is currently seeking?
    I Indrawati

    Hi I have one in-place Directshow transform filter, and I am currently scratching my head looking for ways for the filter to detect that the user is currently seeking through the file (in lieu of the filter playing continous frames). If the user is currently seeking, I want to reset some variables in my filter. Is there a way to do this? Thanks!

    C / C++ / MFC question

  • Directshow - load movie always increase memory usage?
    I Indrawati

    I am currently using Directshow and VC++ to create a simple movie player. I use IGraphBuilder and IMediaEvent interface to render the file (using IGraphBuilder::RenderFile followed by IMediaEvent::Run). When the user selects another movie, I first remove all the filters in the graph (using IGraphBuilder::RemoveFilter) and load the new movie as before. The problem is, there seems to be a memory leak somewhere in my app, since everytime the user selects a new movie, my app's memory usage (seen from Windows Task Manager) always rises by around 1MB and stays there. Could someone tell me what the possible causes for this leak is? Or does someone know a good sample on this topic? Thanks!

    C / C++ / MFC c++ data-structures performance help question

  • Owner-drawn CListBox-derived background color question
    I Indrawati

    Hi I am creating a class derived from CListBox so I can control the fonts, color, etc2. I also want to control the background color of the listbox (not the text's background color, but the whole listbox' background color), and I am doing it by handling WM_ERASEBKGND message in OnEraseBkgnd() function. The OnEraseBkgnd() implementation is very simple, basically I just obtain the client rect and the use CDC::FillSolidRect to fill it with the background color of my choice. The problem is, the background color is correctly drawn if there is at least one item in the listbox, but when the listbox is empty, the background color is always displayed as white, even though I have stepped in the debugger and make sure that the FillSolidRect function is executed. Could someone tell me what the possible cause for this is? Thanks!

    C / C++ / MFC question debugging help

  • Movie player's seeking bar - how should I design one?
    I Indrawati

    Hi I am creating a simple movie player with VC++ 6, and I am planning to create a custom control in the GUI for its seeking purpose (I want to be able to modify the color and look of the seeking bar). I am unsure though, which control should I inherit from for this purpose, CSliderCtrl or CProgressCtrl? CProgressCtrl seems appropriate because the seeking bar is periodically updated when the movie is playing, however, I also want the user to move the seeking bars, something which is provided by CSliderCtrl. Could someone help me on this? Or is there another control which is more appropriate than the two? Thanks!

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

  • DirectShow change resolution on the fly?
    I Indrawati

    Hi I am programming a simple movie player with DirectShow now. Everything seems OK, the only thing I haven't been able to do is to change the movie resolution on the fly (for example, I want user to be able to specify, when the movie is running, whether they want to zoom in or zoom out, etc.) Could someone point me in the right direction on how to do this? Thanks!

    C / C++ / MFC tutorial question

  • Application slows down after running for hours
    I Indrawati

    I have a video processing application that takes input for a web camera, do something on each frame, and immediately display the result. The application runs quite well in the beginning, with frame rate reaching up to 20fps. The problem is, it seems that the application slows down after it has run for a long time (something in the range of 15 hours or so). At this time, the frame rate is only 4 fps or so. I know it is impossible for someone to pinpoint what the problem exactly is, what I want to know is what are the possible causes for this. I have been scratching my head for the past few hours and the solution still eludes me. Some information about my application that may be useful: 1. My app is a directshow filter 2. There is no harddisk access involved, as my app only process input frames (obtained from a webcam) and immediately display them on screen 3. I didn't detect any memory leaks, when my app's performance dropped to 4fps, it is only consuming around 10% of the available memory 4. After the performance dropped to 4fps, sometimes the fps count can increase again up to ~8fps, but it never reaches the original fps count (20 fps) 5. I have tested the app on several PCs with different configurations, and all of them exhibit the same behaviour Thanks!

    C / C++ / MFC performance help

  • Beginner Windows C++ GUI question
    I Indrawati

    Hi I have just started learning C++ GUI programming using Visual C++ (I'm using VC++ 6), and I have two questions regarding it: 1. Let's say I create a dilog-based project, and I put some things (buttons, lists, etc.). The problem is, when the user maximizes the the dialog, the button placements are not automatically modified, leaving a large part of the maximized window blank. Is there a way to automatically reposition ALL the things inside the dialog when the user maximizes the window (or resizes the window, for that matter)? Or do I need to manually recalculate the correct positions and sizes for all the things and apply them one by one? 2.Is there a tutorial/website that explains how I can create other GUIs beside the document/view or dialog-based GUIs that Visual C++ provides (e.g. skin-based GUI, GUI's with shape other than simple rectangle, etc.)? Thanks!

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

  • MFC app doesn't work in debug mode, works in release mode
    I Indrawati

    OK, I am writing an MFC app using Visual C++ 6. The problem is, my program works in the release mode, but it doesn't work in the debug mode (yes, NOT the other way around!). I traced the problem, and it seems that the problem stems from one of my classes, which has a member variables like: private: .... some other things... float number1[30]; float number2[30]; In this class' initialization, I use a for loop to initialize this array to all zeroes. The problem is, it seems that number2's address space overlaps with some other variables, and this overlap corrupts my program, causing some access violation (not debug assertion). This does not happen in the release mode. Could someone point to me how I can deal with this problem? Thanks!

    C / C++ / MFC c++ data-structures debugging help question

  • Non-Static Callbacks
    I Indrawati

    Hi All static members of a class must be defined somewhere. This is necessary since unlike normal member variables, which are created when a class is instantiated, static member variables exist even when there is no instance of the class. For example, if you have something like: in A.h: class A { static int _anInt; }; the you define it as (in A.cpp): int A::_anInt; The definition is usually put on top of your class implementation file, and it is also useful for setting a default value for your static member (i.e. if you want to override the default 0 value), e.g: in A.cpp: int A::_anInt(10) //set _anInt to 10

    C / C++ / MFC c++ com question

  • Non-Static Callbacks
    I Indrawati

    I believe you can use a similiar approach such as: Let's say Class A is the class that you want to access from within the thread. Then you can do something like: in A::something() : (if you're using VC++) AfxBeginThread(fnThread, this); in fnThread(LPVOID param) : A* pObj = static_cast(param); then you can access A's methods like: pObj->aMethod(); of course, provided you have the required access level for it.

    C / C++ / MFC c++ com question

  • Strange Error during execution
    I Indrawati

    Don't know whether this is the same as your case, but I once had a similar problem and it turned out the cause is because of stack overflow. Maybe you can check whether you have enough stack space to hold ProductID? What's the value of BUFFER_LENGTH?

    C / C++ / MFC help data-structures question

  • pointer to struct
    I Indrawati

    The default member access for a class is private, so you can't access pointer outside of the class unless you declare it as public. class someclass { public: somestruct* pointer; }classpointer*;

    C / C++ / MFC help c++ tutorial

  • How to make application not hog the CPU power?
    I Indrawati

    Hi Currently I am building an app that receives frame input from a camera and performs some computations on it. My problem is, my app is currently processing the frames as fast as possible, and that makes the computer's response very slow for other apps, i.e. my application work like this: while(app not closed) getinput(); processinput(); displayoutput(); end while Since this app may be run on a PC for hours and I don't want to disturb other apps' processing, is there a way for my app not to hog the CPU power while it's running, provided I can tolerate some drop in the frame rate? Thanks!

    C / C++ / MFC help tutorial question

  • C++ global const question
    I Indrawati

    Hi Let's say I defined a global const in a header file (which will be #included by many files) as follows: const int MAX_CLIENT = 1000; My question is, will the compiler replace each occurence of MAX_CLIENT with 1000? Should I declare MAX_CLIENT as static const instead? And will the same rule apply if MAX_CLIENT is not an int, but a char array? Thanks!

    C / C++ / MFC question c++ data-structures

  • Multithreading - passing message to a window question
    I Indrawati

    Hi I have an app that use multithreading to update the display of a window. I use AfxBeginThread() to spawn the thread, passing a copy of the window's m_hWnd as its parameter. This thread will then execute SendMessage() to update the window's display. This works OK in the Debug mode. However, in the release mode, it always gives error (The app has encountered a problem and will be closed etc2) whenever I have spawned two of the said threads, and then I switched window! This error still occurs even if I make the member function processing the message to do no processing (i.e. it just returns). However, this error does not occur if I comment out the SendMessage() line in the thread's function. I have tried using PostMessage() instead of SendMessage(), but with the same result. Could someone tell me what's the possible cause for this? Thanks!

    C / C++ / MFC help question announcement debugging

  • Check validity of HWND after window is closed?
    I Indrawati

    Hi I have a VC++6 application in which I continuously update the display for a certain time after the user clicks a button. I accomplished this by creating a separate thread the sends a message to the window via the window's HWND. This way, my app won't 'hang' when the user switches window. However, when this thread is still active, there's a possibility that the user may close the window, invalidating its HWND. Is there a way for the thread to check whether the HWND is still valid? Thanks!

    C / C++ / MFC c++ question announcement

  • C++ global const question
    I Indrawati

    Hi Could someone point me to some online material about C++ global consts? I need to know in what order are they initialized, where they are stored, etc. For example, in my current program, I use a string defined as: const char *const A_STRING = "abcdef"; This string is defined in a header file that is included in many other files. The code compiles and links OK, but if I changed the definition to: const char* A_STRING = "abcdef"; the linker complains that A_STRING was multiply defined. Thanks!

    C / C++ / MFC question c++ tutorial
  • Login

  • Don't have an account? Register

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