I want to get the system's default checkbox for to display it in an owner-drawn MFC menu.
I have read this question, but that did not answer my question.
I want to implement this line:
hbmpCheckboxes = LoadBitmap((HINSTANCE) NULL,
(LPTSTR) OBM_CHECKBOXES);
which I got from MSDN, section
Simulating Check Boxes in a Menu
I get this error: Error C2065 'OBM_CHECKBOXES': undeclared identifier
If I define it myself: #define OBM_CHECKBOXES 32759, and I run the code, then LoadBitmap returns a handle. In VS2015 I see this: hbmpCheckboxes 0xc305143c {unused=??? }, so to me it seems an invalid bitmaphandle is returned. I think there is more missing than just the OBM_CHECKBOXES define, but I can't figure out what.
Is there a file I should include?
Is there a DLL which I need to link
against?
Is there a project setting I should set?
Or...?
Have a look at this topic.
You want to use CBitmap::LoadOEMBitmap and note the comment at the bottom:
Note that the constant OEMRESOURCE must be defined before including WINDOWS.H in order to use any of the OBM_ constants.
Related
I am trying to get the selected column index of the ListView control, but the macro function ListView_GetSelectedColumn returns ZERO, no matter how I click.
a = ListView_GetSelectedCount(lpNmhdr->hwndFrom);
a = 999;
a = ListView_GetSelectedColumn(lpNmhdr->hwndFrom);
a = SendMessage(lpNmhdr->hwndFrom, LVM_GETSELECTEDCOLUMN, 0, 0);
I can reproduce your issue. But I get it working after the following steps. This is my test result:
To use ListView_GetSelectedColumn, specify Comctl32.dll version 6 in
the manifest. Create a manifest and enable your application to use
visual styles.
Refer to ListView_GetSelectedColumn macro and Enabling Visual Styles.
Three steps you need to complete:
Link to ComCtl32.lib and call InitCommonControls. (You have already done.)
Add a file called YourApp.exe.manifest to your source tree that has the XML manifest format. For me as follows:
Add the manifest to your application's resource file as follows:
I call the function XLoadQueryFont(port->dpy, "8x13"), but it returns a NULL. I'm pretty sure I had this working before. If I type locate 8x13, one of the results is
/usr/share/fonts/misc/8x13.pcf.gz
I don't know what the function dislikes, and was wondering as to how to track the problem down.
Update:
Using "fixed" produced an app that executed.
Based on tofo's comments:
I had to install the xlsfonts binary on Arch to get xlsfonts. It listed adobe, lucida, bitstream and misc fonts. xlsfonts | grep misc returned
-misc-fixed-medium-r-semicondensed--0-0-75-75-c-0-iso8859-1
-misc-fixed-medium-r-semicondensed--13-100-100-100-c-60-iso8859-1
-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
Most probably you have deleted or corrupted your fonts.alias file in /etc/X11 (or similar location, depending on your distribution, can be anywhere in the font path).
The "8x13" is typically no name, but rather an alias that is defined in this file.
To ensure your server can use this font name, check that your fonts.alias file contains at least the lines (note your actual font names might vary)
8x13 -Misc-Fixed-Medium-R-SemiExpanded--13-120-75-75-C-80-ISO8859-1
8x13bold -Misc-Fixed-Bold-R-SemiExpanded--13-120-75-75-C-80-ISO8859-1
If those aliases are not present or don't resolve to a valid font, you cannot use the "8x13" name. More aliases can be defined as needed.
Following #DimitreNovatchev's article Programming in XPath 3.0, and using BaseX GUI as the test environment, I tried some of the examples that define functions that accept functions as parameters. E.g. with
let $compose :=
function($f as function(), $g as function())
(The rest of the code isn't relevant to this error, but you can see it as the third example under Function Composition.)
I get this error from BaseX:
Error:
Stopped at 43-compose.xpath, 2/39:
[XPST0003] Expecting 'as', found ','.
The point where the error was detected was on the second line, just before the comma. Apparently, the processor expects the $f parameter declaration to say not just that $f should be a function, but also the return value of the function.
I don't know whether it's right for BaseX to expect that or not. Presumably, Dimitre's examples tested successfully before he made that presentation at Balisage. Maybe something changed in the XPath 3.0 spec between that article and when BaseX was released?
OK, found the answer. I got an evaluation key for Saxon EE, so I was able to try another processor. For future reference, this was the command line:
C:\Program Files\Saxon>java -cp saxon9ee.jar net.sf.saxon.Query -s:"input.xml" -
q:"ex5.xpath" -qversion:3.0
Note that -qversion:3.0 is currently required in order to get any 3.0 functionality.
Saxon throws an error at the same point, but gives a helpful suggestion on how to fix it:
Error on line 2 column 39 of ex5.xpath:
XPST0003 XQuery syntax error near #... function($f as function(), $#:
function() is no longer allowed for a general function type: must be function(*)
I changed function() to function(*) wherever a general function type was wanted, and the errors went away, both in BaseX and in Saxon.
So apparently BaseX was correct (but Saxon's error message was more helpful, as is often the case!). Sounds like something did change in the spec recently. I haven't been able to figure out what the relevant change was, from the change log. But regardless of what changed, the spec currently says that a FunctionTest must have either a * within the parentheses, or an as after them. (This applies to declarations of parameters that are functions, but does not apply to inline functions themselves.)
I'm working with X11 and I've been looking for the reason why, in every program I've seen trying to create an image with XCreateImage, the parameter vis is set to "CopyFromParent".
I've already see this question in stackoverflow.
But the examples also use the same value.
¿Could anyone explain me the reason?
Thank you
It's one of Xlib's classes which says "copy the Visual class Type from the parent". Visual Type being "DirectColor", "PsuedoColor", "red_mask", "green_mask", "blue_mask", etc.
http://tronche.com/gui/x/xlib/window/visual-types.html#Visual
CopyFromParent is a flag saying "copy these values from the, typically the main display window - XOpenDisplay(NULL).
I have some code template that i compiled, i would like to understand one part of the code that i am can't figure out what it does although i have spent a whole day tried to.
the code in question is as follows:
#define IDR_STUB 1
hRsrc = FindResource(NULL, MAKEINTRESOURCE(IDR_STUB), "STUB");
I have another two files in the same directory as the main file, the first one is called `something.rc' and is content is:
#define IDR_STUB 1
IDR_STUB STUB DISCARDABLE "stub.exe"
The other file as you can guess is stub.exe.
My question is what is wrong with the FindResource call above that it can't find whatever is trying to find, I have hard time to understand how that function is suppose to work.
So if you can give me some help i would be glad :)
THX.
Had the same problem. I solved it by using string resource id as described in MSDN:
If the first character of the string is a pound sign (#), the remaining characters represent a decimal number that specifies the integer identifier of the resource's name or type. For example, the string "#258" represents the integer identifier 258.
So try the following code:
hRsrc = FindResource(NULL, "#1", "STUB");
I've stuck in the same issue, when tried to use predefined resource type RC_DATA.
FindResource(hInst, MAKEINTRESOURCE(name), RT_RCDATA);
This code was returning NULL whatever I did.
So when you edit your .rc file you should use constant RCDATA, but when you call FindResource() you should use constant RT_RCDATA. Be careful. Hope I've helped someone.