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
B

Brad Sokol

@Brad Sokol
About
Posts
32
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Is this safe? (map)
    B Brad Sokol

    Yes, this is safe. A reference is an alias for an object that exists elsewhere - in the map, in this case. When a reference goes out of scope, the referenced object still exists and no destructor call is made. In this respect, references work like pointers. Brad

    ATL / WTL / STL c++ com question

  • C++ Standards
    B Brad Sokol

    I looked a while back. On the ISO site (http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=25845&ICS1=35&ICS2=60&ICS3=[^] it's 364 Swiss francs :( I decided I didn't need it that badly :) Brad

    C / C++ / MFC c++ csharp html dotnet com

  • How to create a win32 static library?
    B Brad Sokol

    VC6 has a project type called 'Win32 Static Library'. There is no need to export functions from a static library. Just provide a header file with a declaration. Brad

    C / C++ / MFC tutorial question

  • SEH problem between debug and release version
    B Brad Sokol

    You need to provide a bit more context about your code. That said, I ran into something similar which may be the problem you're having. I had code similar to this: int* pi = NULL; int i = *pi; // Generates an access violation In debug builds, an exception was thrown from my SE handler and caught, but not in release builds. As it turned out, in release builds, the optimiser was correctly removing this code because it had no effect. :doh: Not sure what you're doing, but if it's simple test case like mine, you might want to turn off the optimiser for that block of code: #pragma optimize("", off) Brad

    C / C++ / MFC announcement debugging help question

  • interrupt handling in win2k
    B Brad Sokol

    I'm pretty sure that you need to run in ring 0 which means you write a device driver or similar kernel-mode code. Brad

    C / C++ / MFC question workspace

  • OCX question
    B Brad Sokol

    All COM servers (ActiveX) need to be registered. You can use the regsvr32.exe utility to register .OCX files. Brad

    C / C++ / MFC question com

  • Importing a DLL from a class
    B Brad Sokol

    Hmm...I think you may be a bit confused on how to program with COM ojbects and how they're used at run-time. #import is used only at compile time to include declarations of objects supported by the COM DLL. The path is only relevant on the computer where your code is being compiled. This is very similar to #include. At install time, you must register any COM components that you install. This adds entries to the registry that the COM APIs use to find the DLLs and create the proper execution environment for the components. Most COM DLLs export a function called DllRegisterServer which the DLL author must provide to perform the necessary registration steps. Most installer packages (InstallShield, Wise, etc.) will call this function if you specify the DLL as requiring registration. You can also register a component using the regsvr32.exe utility, which calls DllRegisterServer. So, the path to the DLL is established at registration time and stored in the registry. You can install the DLL anywhere. At run time, you instantiate an instance of a coclass by specifying either a CLSID or PROGID. The COM API CoCreateInstance (which is either called by the smart pointer, or by your code directly, depending on how you've written things), performs a lookup in the registry to find the location of the DLL. A warning about installing MSXML yourself. With later versions of the parser, there are more than one DLL. I'm not sure about V1.0. You are probably better off finding out what installation method Microsoft recommendeds. They probably have an installation package that you can re-distribute. That installer will install all required components and perform the necessary registration. Secondly, V1.0 is very old. Newer versions support more of the XML and related standards. Finally, depending on what OS you're targetting, a version of the parser may already be installed. HTH Brad

    C / C++ / MFC c++ help

  • debug assertion failed
    B Brad Sokol

    Debug assertions typically aren't compiled into release code, so this likely is in the DLL rather than regsvr32.exe. As well, olefact.cpp is an MFC file, so likely not part of regsvr32.exe. Try running the whole thing under the debugger so that you can break when the assertion trips and look at the call stack. Brad

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

  • Importing a DLL from a class
    B Brad Sokol

    Becase MSXML.dll implements a bunch of COM objects, you don't need to do an explicit LoadLibrary call. COM takes care of this for you when you CreateInstance a new instance of a coclass. You only need to know the class id or progid. COM looks up the rest in the registry. That said, you obviously need to have the correct version of the MS XML parser installed on the client machine. Different COM class names map to different versions of the DLL. Brad

    C / C++ / MFC c++ help

  • C++ Regex Library
    B Brad Sokol

    Check out the Boost[^] library. They have a regular expression parser. Brad

    C / C++ / MFC c++ csharp delphi visual-studio game-dev

  • the problem of SEH
    B Brad Sokol

    Getting a stack trace including source file and line number is possible in both debug and release builds. The key is the EXCEPTION_POINTERS parameter. You need to use the symbols engine API which is in the dbghelp.dll library in the Platform SDK to translate the exception pointers into more useful information. The best reference I've found for this is "Debugging Windows Applications" by John Robbins. He used to write the Bug Slayer column in MSDN magazine. You can find lots of his archived articles over at the href='http://msdn.microsoft.com'>MSDN site. There is probably lots of useful stuff elswhere on the web but I don't have any links handy. Google for StackWalk or "win32 stack trace" and you'll probably find some useful links. HTH Brad

    C / C++ / MFC help question

  • where will I find dbgheap.c etc
    B Brad Sokol

    It's part of the C run-time library source. This is not installed by default with Visual C++ 6. If installed, it is in \Program Files\Microsoft Visual Studio\VC98\CRT\SRC. If not installed, just re-run the installer and install the C run-time source as an additional component. For Visual C++ 7.x, it's in \Program Files\Microsoft Visual Studio .NET\Vc7\crt\src or \Program Files\Microsoft Visual Studio .NET 2003\Vc7\crt\src, depending which version you have installed. I can't remember if it's installed as part of the default setup or if you have to drill into the install options to select it. Brad

    C / C++ / MFC debugging question

  • Is one way better than the other?
    B Brad Sokol

    The following two lines are equivalent: std::string s1("one"); // Example 1 std::string s2 = "two"; // Example 2 If I recall correctly, there is a standard "short-cut" that compilers can (must?) take to make example 2 above work like example 1. In other words, declaration with assignment is optimised to a constructor provided that an appropriatly overloaded constructor exists. If no constructor, you get a compiler error. Either would likely be faster then default constructor followed by Format() for two reasons. First, it's two steps. Second, Format() is probably slow with all that string parsing. Of course, YMMV. Brad

    C / C++ / MFC testing beta-testing question

  • Problem with thread
    B Brad Sokol

    Choice e) might be let the thread naturally relinquish the CPU by blocking on an I/O or message queue, for example. Depending on how often/long it blocks, this may be enough. Brad

    C / C++ / MFC help

  • the problem of SEH
    B Brad Sokol

    The function GetExceptionInformation can only be used in the context of an __except block. An easy way to use structured exceptions is to define an SE handler using the C run-time function _set_se_translator(). The CRT takes care of wiring everything together for you, so you don't have to worry about SetUnhandledExceptionFilter etc. You can even avoid __try/__except blocks by throwing a C++ exception. Brad

    C / C++ / MFC help question

  • What's the point of BOOL?
    B Brad Sokol

    The original Win16 API defined a bunch of data types for use in the API. Things like WORD, HWND, BOOL, LPARAM, etc., etc. date back to the 16-bit Windows days. This creates a type system that can be somewhat independent of the underlying hardware and operating system platform. This worked with some - though not complete - success when migrating code from Win16 to Win32 and from Win32 to Win64 (my understanding only, I have no direct Win64 experience). Back in the Win16 days, the bool type was not part of the C or C++ language standards. It wasn't introduced until Visual C++ V5.0. So BOOL was defined in terms of types supported by the compilers of the day. The definition has probably remained to ensure backward compatibility with both code and data. Brad

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

  • COM+ Application to Register my COM Component (VC++). Please Help .........
    B Brad Sokol

    A few simple solutions come to mind. Assuming your ATL COM component is in-process, you could call LoadLibrary() on the DLL, GetProcAddress() on DllRegisterServer() and then call through the function pointer. Alternatively, use CreateProcess() to run regsvr32.exe which essentially does the same as the above. I'm not sure if you can rely on regsvr32.exe being part of a "standard" Windows installation. If your COM component is hosted by an out-of-process server, you can call CreateProcess() on your EXE, passing the "/RegServer" or "/Service" command line argument as required. HTH Brad

    ATL / WTL / STL c++ com help tutorial discussion

  • INI file
    B Brad Sokol

    A line that starts with a semi-colon ';' is treated as a comment and ignored by all the GetXxxProfileXxx() functions. Brad

    C / C++ / MFC

  • Create/Remove Users on Win2000 Server
    B Brad Sokol

    Have a look at the Active Directory doc on MSDN, specifically the samples for creating a user [^]. Brad

    C / C++ / MFC sysadmin

  • Compiling Problem
    B Brad Sokol

    Try generating a make file. If the same problem occurs with nmake, maybe you'll be able to spot the dependency loop in the make file. Brad

    C / C++ / MFC 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