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
J

J B 0

@J B 0
About
Posts
126
Topics
42
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • sizeof function resolution
    J J B 0

    If you are using Microsoft compiler, Take a look its (CL.EXE) options - cl.exe /?

                              -PREPROCESSOR-
    

    /AI<dir> add to assembly search path /FU<file> forced using assembly/module
    /C don't strip comments /D<name>{=|#}<text> define macro
    /E preprocess to stdout /EP preprocess to stdout, no #line
    /P preprocess to file /Fx merge injected code to file
    /FI<file> name forced include file /U<name> remove predefined macro
    /u remove all predefined macros /I<dir> add to include search path
    /X ignore "standard places"

    C / C++ / MFC

  • IWinHttpRequest get_ResponseStream and Bitmap FromStream [modified]
    J J B 0

    Stuart Dootson wrote:

    Maybe because I was using WinHttpReadData rather than getting a stream directly from the IWinHttpRequest object.

    That'd be strange, because I checked the my Stream buffer and it had the same pattern as you described - after first 6 bytes, it comes with "JFIF"

    FF D8 FF E0 00 10 4A 46 49 46
    J F I F

    C / C++ / MFC graphics winforms help question

  • IWinHttpRequest get_ResponseStream and Bitmap FromStream [modified]
    J J B 0

    Dear Stuart, Thanks for the help. I'd get invalid image if I offset the stream by 6 bytes. I am not sure why it worked in your case. Anyway, I found where my problem was. I have that code running outside of GDI+ library init scope. After I moved the following init code to CWinApp::InitInstance(), it worked fine.

    // Initialize GDI+.
    Gdiplus::GdiplusStartupInput gdiplusStartupInput;
    Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);

    C / C++ / MFC graphics winforms help question

  • IWinHttpRequest get_ResponseStream and Bitmap FromStream [modified]
    J J B 0

    Hi, I am writing some code that can download JPEG images from the net (HTTP) and display them on my dialog app. So far I am able to get the image with IStream interface by using IWinHttpRequest's get_ResponseStream(). But I found myself failing to take the Stream object to load it to GDI+ Bitmap object.

    IStream *pStream; // valid Stream object downloaded
    if (NULL != pStream)
    {
    Bitmap *pGdiBmp = NULL;

    // Rewind IStream.
    LARGE\_INTEGER llMove;
    llMove.LowPart = 0;
    llMove.HighPart = 0;
    pStream->Seek(llMove, STREAM\_SEEK\_SET, NULL);
    pGdiBmp = Bitmap::FromStream(pStream);
    

    }

    pGdiBmp is always NULL. I tried to save pStream to disk and the resulted binary is correct JPEG file. What am I doing wrong here? Any help would be great. Thanks in advance.

    modified on Thursday, May 7, 2009 11:48 AM

    C / C++ / MFC graphics winforms help question

  • Process launching
    J J B 0

    Dear Mike, I am trying to do the same, but using CREATE_NEW_PROCESS_GROUP will not make the launched process be a direct descendent of "explorer.exe". Is it because the calling process that calls CreateProcess() is not a parent? What I mean is, imaganing the following process tree from top to bottom. explore.exe-->A.exe->B.exe The calling process is "B.exe", which calls CreateProcess()with CREATE_NEW_PROCESS_GROUP to create "C.exe". And I found "C.exe" becomes a child process of A.exe, instead of "explorer.exe" Is it normal? Is it possible to move "C.exe" the be at least the level as "A.exe"? Thanks in advance, Johnny

    C / C++ / MFC help

  • Use Windows command bar icon (FaceID) on dialog?
    J J B 0

    That's exactly right. I naively thought it is as that's what I was able to do with Visual Studio Automation and Extensibility methods. I simply looked up the face ID and specified it in a method, say AddCommandBar2() (Commands ojbect, EnvDTE namespace). And the icon I picked would appear accordingly. I initially hoped the FaceID resource is somehow accessible globally. This is embarassing :^) Thanks for the help to clearing this out :-D Reference: FaceID Browser[^]

    C / C++ / MFC help question learning

  • Use Windows command bar icon (FaceID) on dialog?
    J J B 0

    Yes, the return code is 1813 (The specified resource type cannot be found in the image file). Perhaps the resource just isn't available for access without explicitly loading from the actual resource DLL? Thanks for the help anyway :)

    C / C++ / MFC help question learning

  • Use Windows command bar icon (FaceID) on dialog?
    J J B 0

    Dear DavidCrow, Thanks for the reply. LoadIcon() returns NULL. I should give more details about my project. The dialog is ATL-based class which is to be brought up via DoModal(). A window-based parent may decide to bring up the dialog at any time. Since the dialog is ATL based (derived from CAxDialogImpl class). The way I use to call LoadIcon in the dialog's OnInitDialog() is in fact:

    HICON hIcon = LoadIcon((HINSTANCE)GetModuleHandle(NULL), MAKEINRESOURCE(540));
    if (NULL != hIcon)
    this->SetIcon(hIcon);

    I get hIcon is NULL in return. Am I doing something incorrectly here? Thanks!

    C / C++ / MFC help question learning

  • Use Windows command bar icon (FaceID) on dialog?
    J J B 0

    Hi all, I am wondering if there is a way to use FaceID icon to a dialog box? I tried to do the following in my dialog's OnInitDialog():

    HICON hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(540));
    this->SetIcon(hIcon, FALSE);

    "540" is FaceID number of a commandbar button icon. Apparently it did not work as the ID did not point to the wanted resource in the dialog project. Any help would be really great. Thanks!

    C / C++ / MFC help question learning

  • Thread execution on button press suggestion
    J J B 0

    Thanks again Roger, for very informative reply and link. They helped greatly. Best Regards, Johnny

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

  • Thread execution on button press suggestion
    J J B 0

    Thanks a lot for the suggestion Roger, I am wondering where I should close the thread's handle (CloseHandle(hThread)) if I do not check for its actual completion. Receiving the message handler's call does not mean the thread's already returned I think? Another problem is that my task may contain multiple thread creations at the same time, the window would need to know when they all terminated too, which then I will get their exit codes for processing(GetExitCodeThread) as well as retrieve a timestamp at the time. Some sort of "wait-until-all-done" is still needed for my case I think? And obviously that shouldn't be done in the main window. That's why I thought about creating a thread or a timer which creates and does my thread tasks. Thanks again, Best Regards, Johnny

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

  • Thread execution on button press suggestion
    J J B 0

    Thanks a lot for the reply, Peter, This would work partially. But I think this is will not solve the frozen dialog window problem I am having, as long as I use WaitForSingleObject() or WaitForMultipleObjects() (multiple tasks executed at once) in my dialog's cpp. I have to wait until all the thread are terminated to calculate the total execution time. That's why I thought about putting WaitForSingleObject() or WaitForMultipleObjects() in another thread or Timer which creates the (threaded) tasks, without blocking dialog's window messages. I hope it makes sense. Thanks again, Best Regards, Johnny

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

  • Thread execution on button press suggestion
    J J B 0

    Hi all, I am creating a dialog app that has a button. When the button is pressed, in OnButton function of the dialog's cpp it creates a thread (I am using CreateThread())that runs some task. I will have to wait for the task's completion by watching the thread's termination via WaitForSingleObject(hThread, INFINITE) there. Now, the thread 's execution may take seconds so the WaitForSingleObject() would actually block windows messages and the dialog window "freezes" during the time. I'd love to NOT have the dialog frozen but simply have the button disabled during the thread task's execution. As now I have two ways in mind: 1. Use Timer and places the thread creation process in the Timer's function instead. Disabling and re-enabling button can be directly done in the function. 2. Create a main thread that does the thread creation process. The main thread will disable and enable the button via PostMessage(). I am just wondering what an appropriate approach would be to solve this problem? Thanks in advance, Best Regards, Johnny

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

  • Determine virtual function table size
    J J B 0

    Hi all, I am wondering if it is possible to determine the size (or number of valid function entries) of a virtual function table using the queried interface pointer. Say I obtained an interface pointer pIMyvia QueryInterface:

    pIBase->QueryInterface(&IID_MYINTERFACE, (void**)&pIMy, hr);

    I was able to cast the pIMy to vtable pointer pVTable and access each each function's address value with pVTable[0], pVTable[1]..etc. And obviously sizeof(pVTable) returns 4 instead of size of the vtable. Any ideas how it is possible to determine the size virtual function table? Thanks in advance, J.B.

    COM question

  • COM concept help - order of functions or parameters
    J J B 0

    Hi Steve, wow, thanks for the reply. That's the best answer I could've asked for. Thanks again! J.B.

    COM question com performance help tutorial

  • COM concept help - order of functions or parameters
    J J B 0

    Hi guys, as I recently dig into the world of COM by reading Inside COM by Dale Rogerson, I encounter this question in the early chapters. In the book it says you should always make a new version of interface when - Order of functions in an interface changes - Order of pamaters in an function changes What exactly do this imply? The order as in the position order the fuctions or parameters listed out? For example: interface IX : IUnknown { virtual void __stdcall Fx() = 0; virtual void __stdcall Fy() = 0; }; changes to interface IX : IUnknown { virtual void __stdcall Fy() = 0; virtual void __stdcall Fx() = 0; }; if it is what the book means, when it says that a new version is required, is it because that the virtual function table are no longer the same for the above two interfaces, where the functions (or in other case parameters) would reside in different memory block addresses?:confused: Thanks~

    COM question com performance help tutorial

  • Looking for Word/Excel Object model doc
    J J B 0

    Thanks alot Shog, it does provide much more useful information for me :) Further advancing to the topic, I start creating and formatting Excel sheet by following How to use MFC to automate Excel and create and format a new workbook[^] example. Most parts are very easy to follow except that I can't seem to find the OLE-specific CFont0 class as stated. Adding #include "cfont0.h" to my main .cpp file would just return fatal error C1083: Cannot open include file: 'CFont0.h': No such file or directory Any help would be great, Thanks

    C / C++ / MFC c++ csharp hardware question

  • MFC version used ?
    J J B 0

    Nope ! Only if you choose to statically link the MFC to your project.

    That's what I have done in my most projects. Just wondering, if there is any reasons that should not be done, except an increase of overall application size. Thanks

    C / C++ / MFC c++ csharp visual-studio question com

  • Looking for Word/Excel Object model doc
    J J B 0

    Hi guys, I am developing an app that will have an automated Excel object embedded. I am doing it by using typelib Wizard to include Excel Object Model classese and access its methods. As I am new to this, I was hoping to find some documentations about the classes. Unfortunately, I couldn't find any useful information for my own use, except the MSDN site which describes only some of the methods with VB and C# examples (no C++/MFC). Does anyone know where I will be able to find more references to the Office Object Model? Thanks alot~

    C / C++ / MFC c++ csharp hardware question

  • Project help - Database + Excel
    J J B 0

    Hi guys, I am planning to write a GUI-based program (possible using MFC) that needs some kind of database to store simple datasets. The program will need to be able to add/delete/edit/search data and display it in a nicely formatted Excel document. That means GUI screen will inlcude an embedded Excel that needs frequent updates when displaying data on different search results. Could someone offer some suggestions where I should start? I did some search and found the possible use of OBDC Excel driver. Am I heading the right direction? Thanks alot

    C / C++ / MFC c++ database hardware help question
  • Login

  • Don't have an account? Register

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