|
An application is not an icon file. However, an application can have icons in it's resources. You need to load the application into memory (try LoadLibrary() ) and then pass the HINSTANCE returned from that into LoadImage() . You'll also have to specify the resource ID of the icon.
Alternately, you could use ExtractIconEx() . Check out this article for an example.
Developers that like shiny objects also dig case mods and scratch-and-sniff stickers. Klaus Probst, The Lounge
|
|
|
|
|
Many, many thanks, Shoq9!!!
With "ExtractIconEx" it works perfectly!!!!
Amar
|
|
|
|
|
Many icon contain 16x16 sub-icons,Use Icon Searcher to collect system icons.
Icon Searcher performs fast scan of all local hard
disks for icon images(Support XP style icon). The
program handles lots of different file formats,
like DLL, EXE, ICO, ICL, OCX ,SCR, CPL ,BPL and
extracts all available icons from files to the user-friendly visual image list.
|
|
|
|
|
Keywords: functional library, functors, ponter to members
Hello,
I do need som help regarding casting to member functions.
I do want to implement a parent class named 'CCommandManager' that would implement a vector container with member function pointer to be called scheduled.
typedef void(*pt2func)(LPVOID);
// command table entry
typedef struct _tagCommandEntry {
pt2func lpfunc; //member function pointer
LPVOID lpparam; //member function parameter
} *LPCOMMANDENTRY,COMMANDENTRY;
class CCommandManager
{
public:
CCommandManager();
virtual ~CCommandManager();
//Adds new entry to the vector
void addEntry (pt2func lpfunc , LPVOID lpparam);
//calls function member
void run();
private:
std::vector <commandentry> m_vcommandTable;
};
//run goes through vector entries and call function members
void CCommandManager::run() {
std::vector<commandentry>::iterator itr;
for (itr = m_vcommandTable.begin() ;
itr != m_vcommandTable.end() ; itr++) {
(itr->lpfunc) (itr->lpparam); //member function call
}
}
The second class will implement this interface
class CMyClass : public CCommandManager
{
public:
//member function
void funcA (LPVOID lpp) { /*does nothing */};
};
void main( void ) {
CMyClass c;
UCHAR a = 'a';
c.addEntry(a,1000,(pt2func)c.funcA,(LPVOID)&a); //ERROR
}
This is what I get when compiling
>error C2440: 'type cast' : cannot convert from '' to 'void (__cdecl *)(void *)'
As you can see sintax is much more like C function pointers calling, I've been looking some resources but information is quite confusing
Ideally any class that implement CCommandManager interface would be able to add to the vector (schedule) any of its member functions, no matter what type or number of paramteres (I know this is quite hard to achive)
After adding to the vector whatever functions you wan't to schedule in time, CCommandManager::run method will call member functions whatever order has been specified.
I hope you guys got the idea, and will be able to give me some hint.
Do I use functors? how?
NOTE: ask for source code to carlossg00@hotmail.com.
Thanks in advanced.
Carlos.
|
|
|
|
|
You function pointer need to be static
class CMyClass : public CCommandManager
{
public:
//member function
static void funcA (LPVOID lpp) { /*does nothing */};
};
Normski. - Professional Windows Programmer
|
|
|
|
|
Norm Almond wrote:
You function pointer need to be static
Nope, but this is a workaround.
static void funcA(LPVOID lpp, CMyClass* pThis);
when you call funcA pass in a pointer to your class, now you can have full access.
Normski. - Professional Windows Programmer
|
|
|
|
|
You call addEntry like this:
c.addEntry(a,1000,(pt2func)c.funcA,(LPVOID)&a); //ERROR
and you declared it like
voidid addEntry (pt2func lpfunc , LPVOID lpparam);
How sould it convert a char to a pointer to function?
Best regards,
Alexandru Savescu
|
|
|
|
|
is there a way to set the enter key to work like a tab key when moving through different cedit controls? or would i have to create a keypress event for each control?
|
|
|
|
|
Yes there is. Override your PreTranslateMessage function as follows:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
{
CWnd *pWnd = GetFocus() ;
if (pWnd != NULL)
{
CEdit *pEdit = static_cast<CEdit*>(pWnd) ;
if (pEdit)
{
pMsg->wParam = VK_TAB ;
}
}
}
return CDialog::PreTranslateMessage(pMsg);
}
This converts all return presses to tabs so that it should tab from control ro control instead.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
That should have read
CEdit *pEdit = static_cast<CEdit*>(pWnd) ; // returns NULL if its not a CEdit* control
but the HTML parser stripped it out
Roger Allen
Sonork 100.10016
<small>If I'm not breathing, I'm either dead or holding my breath.</small>
<small><b>A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?</b></small>
|
|
|
|
|
|
I got the problem, that the combobox can be edited by the user. but i just want him to choose from my values in the list.
the option of "DROPDOWN LIST" isn't of use, cause i have to tell the combobox which value it should have, everytime the dialog comes up.
so my aim: a list field, where i can define the initialsing value.
knows somebody any solution?
|
|
|
|
|
I cannot see why the combo box style CBS_DROPDOWNLIST isn't of any use since it does exactly what I guess you want: disabling the edit box of your combo.
If you want to populate your list, or set it to an initial value, do it in a handler for WM_INITDIALOG. That way your combos list will be initialized before your dialog is shown.
|
|
|
|
|
If i disable the Editbox by using CBS_DROPDOWNLIST, the dropdown field is empty, even if i initialised the variable with 0. so i want the 0 to be (pre)chosen from the list (values from 0 to 3). when i use dropdownlist, the dropdown cant be edited, but is also blank when the dialog comes up...
do you understand what i mean???
|
|
|
|
|
If your using MFC (???)
try the following in your
BOOL CDDDDIalog::OnInitDialog()
{
CDialog::OnInitDialog();
m_wndCombo.AddString("#1");
m_wndCombo.AddString("#2");
m_wndCombo.AddString("#3");
m_wndCombo.SetCurSel(0);
return TRUE;
}
If you're not using MFC, in your handler for WM_INITDIALOG, try something like:
::SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)"#1");
::SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)"#2");
::SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)"#3");
int nIndex = 0;
::SendMessage(hWndCombo, CB_SETCURSEL, nIndex, 0);
|
|
|
|
|
trying to compile a Visaul C++ dll for a VB application.
what setting must I set.
I have created the following heading:
#define CEEPROGS
extern "C" // need for 'C' & VB progs
{
#ifdef CEEPROGS
declspec(dllexport)
#else
int APIENTRY CVDDLL_Main(char *Src,int Srclen,char *DestName,char *ErrorLog);
#define OURCALLING APIENTRY
#endif
}
and from the VB side I declared it as:
Public Declare Function CVDDLL_Main Lib "cvddllmain.dll" (ByVal sFile As String, _
ByVal iLen As Integer, _
ByVal sFileDesc As String, _
ByVal sErrorLog As String) As Integer
now everytime i call CVDDLL_Main I get a bad dll calling convention error?
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
the function dec i use:
extern "C" int __declspec(dllexport) __stdcall MakeQuery (long nUseAvailable,DWORD searchjob_id,DWORD search_id,DWORD user_id);
the function def line:
int __declspec(dllexport) __stdcall MakeQuery(long nUseAvailable,DWORD searchjob_id,DWORD search_id,DWORD user_id)
the vb module entry:
Public Declare Function MakeQuery Lib "qdbprint.dll" _
Alias "_MakeQuery@16" (ByVal uservailable As Long, ByVal SearchJobID As Long, ByVal search_id As Long, _
ByVal user_id As Long) As Integer
hope this helps
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
why ;
Alias "_MakeQuery@16"
do u have to include this?
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
it lets u use MakeQuery (in the example) instead of _MakeQuery@16 (which i believe is an illegal name in vb)
the @16 bit comes from the number of params u pass ... generally it seems to be 4 bytes per param
if you do it like this it will work
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
ok, I change my VB declaration:
Public Declare Function CVDDLL_Main Lib "cvddllmain.dll" Alias "_CVDDLL_Main@16" (ByVal sFile As String, _
ByVal iLen As Integer, _
ByVal sFileDesc As String, _
ByVal sErrorLog As String) As Integer
my c declaration still is:
#define CEEPROGS
extern "C" // need for 'C' & VB progs
{
#ifdef CEEPROGS
__declspec(dllexport) int CVDDLL_Main(char *Src,int Srclen,char *DestName,char *ErrorLog);
#define OURCALLING __declspec(dllexport)
#else
int APIENTRY CVDDLL_Main(char *Src,int Srclen,char *DestName,char *ErrorLog);
#define OURCALLING APIENTRY
#endif
}
but now i get this error:
Can't find DLL entry point _CVDDLL_Main@16 in cvddllmain.dll
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
ummmm
i dont see your __stdcall bit anywhere?
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
OHHHH!!!! THANKS YOU!!!!
/me very happy now.
)
))
thanks again for all you help. works like a bomb now!
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
Hi,
I have a pointer to an XMlDomDocument, and I would like to have an exactly the same copy of that DomDocument in to another XMLDomDoc ( the content, not the adress), I guess maybe is not so correct to think that with a copy constructor I will have it all solved ( or yes ?).
one *bad* idea about doin that is: get the XML string, and tell the other instance to generate the XML doc from that string... what that would be not very.... optimal...
Can you help me ?, Thanks in advance, Greetings
Braulio
|
|
|
|
|
It has a clone method, or at least the nodes do, so grab the top level node, and clone it when you insert it into a new document.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Mmm... but I´m afraid that it doesn´t work for the root node..
Thanks !
Braulio
|
|
|
|
|