|
Options:
1) The button is a window, so if you can get a hwnd to that button, you should be able to disable it. Create a basic dialog-based app with a single combo box control in it, and use Spy++ to see if you can get the necessary info about the various parts of the control.
2) You may have to set the control to be owner-drawn so you can handle the disabled appearnce manually.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
And googling found this article right here on CodeProject:
http://www.codeproject.com/cs/miscctrl/disabledcombodisplay.asp[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
Try this
typedef HRESULT (__stdcall *DllRegSvr)();<br />
HMODULE hModule = LoadLibrary("dll path");
|
|
|
|
|
Thanks. Got it working
|
|
|
|
|
Welcome .
|
|
|
|
|
Just try not to do it in the DllMain handler for your DLL.
You can run into locking issues - Windows only wants to load a single DLL within your process at a time and process the DllMain.
|
|
|
|
|
Hello all,
I have List Box and rich edit box in my Dialog IDC_SLIST & IDC_FILECONT
List Box contains the text file names , When the user double click on the list box that file content should be displayed in the rich edit box.
Can u please tell me what all the changes I have to make and how to do the double click event in Api application ??
<br />
case WM_COMMAND:<br />
switch(LOWORD(wParam))<br />
{ <br />
case LBN_DBLCLK:<br />
{<br />
HWND hwndListBox = GetDlgItem(hwnd, IDC_SLIST);<br />
int iCurSel =::SendMessage(hwndListBox,LB_GETCURSEL,0,0);<br />
TCHAR FName[25];<br />
SendMessage(hwndListBox,LB_GETTEXT,(WPARAM)iCurSel,(LPARAM)FName);<br />
<br />
<br />
CStdioFile file(FName, CFile::modeRead);<br />
DWORD dwSize = file.GetLength();<br />
char *pBuffer = new char[dwSize + 1];<br />
UINT uRead = file.Read(pBuffer, dwSize);<br />
pBuffer[uRead] = '\0';<br />
file.Close();<br />
<br />
HWND hwndRichEdit = GetDlgItem(hwnd, IDC_FILECONT);<br />
SendMessage(hwndRichEdit,EM_SETTEXTMODE, pBuffer,0);<br />
delete [] pBuffer;<br />
}<br />
<br />
Thanking you,<br />
Suresh HC<br />
<br />
<br />
-- modified at 5:37 Friday 16th February, 2007
|
|
|
|
|
Suresh H wrote: SendMessage(hwndRichEdit,EM_SETTEXTMODE, pBuffer,0);
Use ,
::SendMessage(hwndRichEdit,WM_SETTEXT, 0,(WPARAM)pBuffer);
|
|
|
|
|
Hi Prasad,
Thank you very much for the response.
I tried with this code but no response list box double click event is not working.
<br />
case LBN_DBLCLK:<br />
{<br />
MessageBox(hwnd, "DB click!","DB click event", MB_ICONEXCLAMATION | MB_OK);<br />
}<br />
break;
and also I am not able to use CFile , this works in MFC but I am using win 32 api, what changes I have to make ???
<br />
CStdioFile file(FName, CFile::modeRead);<br />
DWORD dwSize = file.GetLength();<br />
char *pBuffer = new char[dwSize + 1];<br />
UINT uRead = file.Read(pBuffer, dwSize);<br />
pBuffer[uRead] = '\0';<br />
file.Close();<br />
|
|
|
|
|
Do you have LBS_NOTIFY on your listbox?
From the MSDN
Only a list box that has the LBS_NOTIFY style will send this message.
|
|
|
|
|
Hi WhiteSky,
Thanks for the responce.
How to check ????
|
|
|
|
|
Insert LBS_NOTIFY when create listbox
<br />
hList=CreateWindowW(_T("LISTBOX"),NULL,LBS_NOTIFY|WS_BORDER|WS_CHILD|WS_VISIBLE,0,0,100,200,hWnd,(HMENU)IDC_SLIST,hInst,0); <br />
|
|
|
|
|
Hi whiteSky,
I did that in the
<br />
BOOL CALLBACK SDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch(Message)<br />
{<br />
case WM_INITDIALOG:<br />
{<br />
<br />
HWND hwndListBox = GetDlgItem(hwnd, IDC_SLIST);<br />
hwndListBox=CreateWindowW(_T("LISTBOX"),NULL,LBS_NOTIFY|WS_BORDER|WS_CHILD|WS_VISIBLE,0,0,100,200,hwnd,(HMENU)IDC_SLIST,hwndListBox,0);<br />
<br />
i am getting error
error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'char [8]' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
|
|
|
|
|
I wanted to said insert LBS_NOTIFY when create your listbox
|
|
|
|
|
WhiteSky I am using wizard for creating dialog and dialog controls , I am not using any code to create the dialog.
|
|
|
|
|
He has created list box, shown in above post.
|
|
|
|
|
Suresh H wrote: hwndListBox=CreateWindowW(_T("LISTBOX"),NULL,LBS_NOTIFY|WS_BORDER|WS_CHILD|WS_VISIBLE,0,0,100,200,hwnd,(HMENU)IDC_SLIST,hwndListBox,0);
Use CreateWindow instead of CreateWindowW . You are trying to use UNICODE version in Non -UNICODE application.
|
|
|
|
|
Hi prasad, again i am getting error..
HWND hwndListBox = GetDlgItem(hwnd, IDC_SLIST);<br />
hwndListBox=CreateWindow(_T("LISTBOX"),NULL,LBS_NOTIFY|WS_BORDER|WS_CHILD|WS_VISIBLE,0,0,100,200,hwnd,(HMENU)IDC_SLIST,hwndListBox,0);<br />
error :-
rror C2664: 'CreateWindowExA' : cannot convert parameter 11 from 'struct HWND__ *' to 'struct HINSTANCE__ *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
|
|
|
|
|
One question HWND hwndListBox = GetDlgItem(hwnd, IDC_SLIST);
what is it? before CreateWindow
|
|
|
|
|
WhiteSky I am creating a handle for the list box control {IDC_SLIST }
|
|
|
|
|
So do you have two listbox on your project?
|
|
|
|
|
Suresh H wrote: hwndListBox=CreateWindow(_T("LISTBOX"),NULL,LBS_NOTIFY|WS_BORDER|WS_CHILD|WS_VISIBLE,0,0,100,200,hwnd,(HMENU)IDC_SLIST,hwndListBox,0);
Here, instead of handle you need to pass handle to instance. Pass instance that you will get through WinMain .
|
|
|
|
|
BOOL CALLBACK SDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
{
// HWND hwndListBox = GetDlgItem(hwnd, IDC_SLIST);
hwnd=CreateWindow(_T("LISTBOX"),NULL,LBS_NOTIFY|WS_BORDER|WS_CHILD|WS_VISIBLE,0,0,100,200,hwnd,(HMENU)IDC_SLIST,hwnd,0);
again error :-
error C2664: 'CreateWindowExA' : cannot convert parameter 11 from 'struct HWND__ *' to 'struct HINSTANCE__ *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
|
|
|
|
|
You have two hwnds on CreateWindow? wheres HINSTANCE
|
|
|
|
|