Hope you enjoy the series as much as so many of the rest of us already have. One day you're playing with a triangle, the next with particles the day after you're trying to remember what you were supposed to be doing away from the computer.
strstr() finds a substring in a string. use it to search inside string elements.
char mainString="string to search";
if ( strstr(mainString, strstr_sub_string_to_search)) puts("strstr() found Substring in main string\n");
else puts("strstr() did not find Substring in main string\n");
You are passing a string using the VARIANTpcVal member. Strings are usually passed using the bstrVal member with type VT_BSTR. When using MFC, you may use the COleVariant type which creates a VT_BSTR when passing a string:
Another error may be the name of the used function oBookmarks.Item(). Please check if this functions exists. If you have imported a typelib, see the generated header file. With C++ OLE automation, many item access function are named GetItem() and SetItem().
How does one write code to make drawings in the Windows main client area of a Win32 C++ app? I found an example online that uses the "eclipse" API but when I put it in my program, the IDE complained so it would not compile.
You can use the Windows GDI functions like Rectangle, Ellipse, TextOut, LineTo, MoveTo etc. to draw in the window. Each of these functions take a device context (DC) as its first parameter. It is this device context that determines where the drawing appears. In your case use the GetDC function with the handle to the window to get the device context of the window where you want to draw.
«_Superman_» I love work. It gives me something to do between weekends.
In a general win32 program you should handle the WM_PAINT (and maybe the WM_ERASEBKGND) message of the windows you want to paint. In WM_PAINT you might get a HDC handle to draw on (with GDI functions[^]). If you are not working with a framework that gives you a HDC to draw on then you have to call BeginPaint()[^] and EndPaint()[^] in your WM_PAINT handler and beginpaint gives you a HDC draw on before you call EndPaint(). Its important to draw you window from the WM_PAINT handler because the surface of your window might get lost any time (at least this was the case before 3D accelerated desktops) for example when someone brings a window in front of your window and then it switches back to your window. In this case windows might send a WM_PAINT to your window to redraw its surface and the thing you drew on it will disappear if you don't redraw it from the WM_PAINT. You can't assume that the thing you draw on a window remains there if you perform drawing from outside the WM_PAINT handler.
For simple drawings, go with GDI... it'll give you a basic understanding of how Windows draws things. Obviously, this isn't really suitable for complex graphics, but it's a great starting point for someone with no experience with graphics development.