|
If your resources are contained directly within your EXE file, then use GetModuleHandle(NULL) to retrieve the 'instance' handle used for loading the resources
|
|
|
|
|
When you said an "MFC based service" before, do you really mean a MFC service, or an ATL service with "support MFC" checked. If you have the latter, you need to "fool" MFC by doing the following:
CWinApp waWA;
waWA.m_hInstance = _Module.GetModuleInstance();
afxCurrentInstanceHandle = _Module.GetModuleInstance();
afxCurrentResourceHandle = _Module.GetResourceInstance();
Then things that refrence the global CWinApp instance will work correctly. Kludgy, but that is what you get for mixing MFC and ATL with VC++ 6.0!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
No, there is no ATL support in this project.
|
|
|
|
|
GetModuleHandle(NULL) returns 0x00400000, which is not a valid handle.
|
|
|
|
|
Have you tried using it? Even if it was invalid, using FindResource(...) with a NULL hModule parameter should default to using the load image (EXE).
Are the resources present in the executable itself, and not in another DLL? Are you sure they are being linked in correctly? One way to test is to open a new instance of DevStudio, and open the EXE file being sure to specify "Resources" in the "Open As" combobox. You can them be sure that the resources are actually there and accessable - you should be able to double-click on them and see them in the binary editor.
I am running out of ideas here...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Yea, so am I! Yes, when I use the invalid handle, I just get another null.
|
|
|
|
|
Yes, the resources are in the EXE. I have opened the EXE in binary mode with the IDE's resource editor and I can see them.
|
|
|
|
|
while trying to use GetTextExtentExPoint function I get the following error during compilation:
c:\Documents and Settings\Admin\My Documents\Visual Studio Projects\InfoBrowser\InfoBrowserView.cpp(387): error C2039: 'GetTextExtentExPointI' : is not a member of 'CDC'
But according to the "manual" it should be a member...
Just to be complete I am sending part of a code:
void CInfoBrowserView::drw_DVDDetail(CDC* pDC)
{
pDC->TextOut(rect_DVDDetail.left,rect_DVDDetail.top,"Název:");
pDC->GetTextExtentExPointI();//the parameters are missing, but that shouldn't affect the error...
}
thanks for any elp
|
|
|
|
|
webmaster1234463653 wrote:
But according to the "manual" it should be a member
which version of VC++ are you using?
the MSDN for VS.Net lists it as a member of CDC, but the MSDN for VC6 doesn't have it.
this might have been added in MFC 7
-c
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Use the following instead of:
BOOL GetTextExtentExPoint(
HDC hdc, // handle to DC
LPCTSTR lpszStr, // character string
int cchString, // number of characters
int nMaxExtent, // maximum width of formatted string
LPINT lpnFit, // maximum number of characters
LPINT alpDx, // array of partial string widths
LPSIZE lpSize // string dimensions
);
Jack
---------------------------------------------------------------------------------
XD++ MFC/C++ Flow/Diagram Library -- http://www.ucancode.net
|
|
|
|
|
Hi
I want to check if my current process has the proper access rights to a file. I read about the ACL and windows security and I understand how they work conceptually. But I am not sure how to invoke the functions to do my checks.
Up to now (correct me if I missunderstood something) I am about to use
GetFileSecurity() to get the security ID of my file. It seems that I have to call it with OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION to get all the ACLs of that file in the proper order.
It also seems that I have to call the OpenProcessToken() with the current process handle to get my current process rights.
Then I have to call (according to my understanding) the AccessCheck to verify my access. And there is where I am stack. I know that I need to specify desired access and the GENERIC_MAPPING structure. I think that for read the desired access is FILE_READ_ATTRIBUTE | FILE_READ_DATA | FILE_READ_EA | READ_CONTROL | SYNCHRONIZE, for write FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | FILE_WRITE_EA | WRITE_CONTROL | SYNCHRONIZE, for execute or directory traversing FILE_READ_ATTRIBUTES | READ_CONTROL | FILE_EXECUTE | SYNCHRONIZE and for deletion DELETE (or do I also need to combine the write flags also)?
I 've seen the GENERIC_READ, GENERIC_WRITE and the GENERIC_EXECUTE flag. I am not understanding what to declare in the GENERIC_MAPPING structure and what to use in the MapGenericMask function (which the MSDN suggests to use).
Please help me since I am begginer to windows security coding.
Thanks...
Dimitris Vikeloudas
|
|
|
|
|
Could you give tutorials about drawing application by moving objects ?
Thank you.
|
|
|
|
|
Could you give me tutorials about drawing application by moving objects ?
Thank you
|
|
|
|
|
You have a microsoft certificate, or you want one ? Why don't you register ?
What do you want to know ? You want to create drag and drop objects, like Visio ? To do that, you need an array of objects and an array of points that represent where you can grab an object. When someone clicks, you need to step through your array and work out if something has been clicked that you want to drag, then you need to move the co-ordinates for that object as you drag. Finally, your draw function should redraw the objects based on those co-ordinates.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Hi
1) How to get list of workgroups in LAN?
2) How to get list of computers in specified workgroup?
Application must run on Windows 2k/xp, I use VisualC++ 6.0
------------------------------------------
gouranga
JID badzio(at)chrome(dot)pl
------------------------------------------
|
|
|
|
|
badzio wrote:
2) How to get list of computers in specified workgroup?
How about NetGroupGetUsers() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
<br />
const WCHAR * srvName=NULL;<br />
DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH;<br />
DWORD dwEntriesRead = 0;<br />
DWORD dwTotalEntries = 0;<br />
DWORD dwTotalCount = 0;<br />
DWORD dwLevel = 0;<br />
DWORD dwResumeHandle = 0;<br />
NET_API_STATUS nStatus;<br />
GROUP_USERS_INFO_0 usrbuf;<br />
CString ls_grp="Alfasoft";<br />
wchar_t grp[UNCLEN+4];<br />
mbstowcs( grp, ls_grp, lenof( grp) );<br />
nStatus = NetGroupGetUsers(srvName,grp,dwLevel, (LPBYTE *) &usrbuf,dwPrefMaxLen,&dwEntriesRead,&dwTotalEntries,&dwResumeHandle);<br />
result: nStatus = 2220 (NERR_GroupNotFound)
but groupname - Alfasoft is valid. This group exists (my computers in in this group)
So - what do I do wrong?
I'm affraid that this function is linked with groups on computer not in LAN
------------------------------------------
gouranga
JID badzio(at)chrome(dot)pl
------------------------------------------
|
|
|
|
|
Is "Alfasoft" a global group in the security database? You might also try NetLocalGroupGetMembers() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hmmm... I don't know anything about security database
I have LAN. In this LAN are many computers and 4 workgroups. My computer belongs to Alfasoft. Computers of my friends from the same room - too. But computers of another workers belong to another workgroup. Every computers are in the same LAN, in the same subnet (192.168.0.x)
And I want get list of all workgroups in my LAN and list of computers in specified workgroup.
NetLocalGroupEnum() returns local user's groups. But I want computers from workgroups.
------------------------------------------
gouranga
JID badzio(at)chrome(dot)pl
------------------------------------------
|
|
|
|
|
I know exactly what you are looking for, but since I do not work with the Netxxx() API, my answers may be a bit rusty. I'll keep looking...
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
what do u mean "global group in the security database"?
------------------------------------------
gouranga
JID badzio(at)chrome(dot)pl
------------------------------------------
|
|
|
|
|
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
1) See WNetOpenEnum , WNetEnumResource and WNetCloseEnum .
|
|
|
|
|
but function WNetOpenEnum() returns all computer in network. But I need
1) list of all workgroups
2) list of computer from specified workgroup
So I can't get it using WNetOpenEnum()
------------------------------------------
gouranga
JID badzio(at)chrome(dot)pl
------------------------------------------
|
|
|
|