|
Jörgen Sigvardsson wrote:
aren't these functions for property page dialogs and the likes?
Yes they are.
But you could still use them, you would just have to create an empty (as in no controls) DLGTEMPLATE structure in memory, and use that to create the pages. Then dynamically create all your controls on the page later. I am sure there are many was to skin that cat and you will find the best one for you.
Have fun!
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
can we have a screenshot?
I have an ActiveX that basically does the same, but doesn`t exhibit the problem
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
I can't give you a screenshot I'm afraid. 1) I'm not at the office, 2) I don't have a good server to put it on.
Besides, I think I know a workaround. It's the damn button's fault; it uses its parent's DC, which is clipped somehow by the scrollbuttons in the tab control. If I put a window which uses its own DC on the tab control, which hosts the child controls, it should work. And that is probably the "trick" too. Almost all tab controls I've seen, has all of its children on a dialog child control. A dialog child control has its own DC, and is thus not affected by peculiarities of the tab control.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
I've managed to add a button to the IE main toolbar using the extension configuration section in the registry and I've implemented an IOleCommandTarget COM object to handle the button click.
The question is, how can I get the co-ordinates of my button out of IE so that I can display my menu of options neatly aligned below it? Any help or pointers to info would be gratefully appreciated!
|
|
|
|
|
Hi,
I am using the string table to hold all the UI string I use in my application. However I cannot seem load them into my program. this is the sequence i use:
CString test;
int y;
DWORD Failure;
y = test.LoadString(IDS_APN);
Whenever i call the GetLastError() commnad, the error code indicates the string is not present, even though it is present in both the string table editor and the Resource.h file.
What am i doing wrong?
Thanks in advance,
femi.
|
|
|
|
|
You have shown almost no code, and some of it even unrelated (the DWORD-declaration), so the answer you'll get will most likely be "no idea". And in fact it is. The problem could be that you try to do this from a DLL, that the string id in the string table is actually "IDS_APN", not IDS_APN (a significant difference), that you have spelled the resource id wrong, but still the same as another resource id in resource.h, etc. etc. etc.
|
|
|
|
|
Your right there is almost no code, thats because i didnt get past that line, the DWORD was used to retreive the error code after the 'LoadString' command. But i am loading the string from a dll, from your reply i take it that isnt normally possible?
|
|
|
|
|
It is possible to load a string in a DLL, but there are some things that will have to be considered first. A short background:
Resources are loaded from an application/DLL using the app/DLL HINSTANCE (that is a unique identifier for this instance of the app/DLL - a little bit like a window handle for the whole module, if I'm allowed to stretch my analogies). MFC hides this, in the API-wrappers normally taking the HINSTANCE as an in-parameter (such as ::LoadString ), a hidden HINSTANCE for the application is used. A DLL gets to be a part of the application, so if you access resources from the DLL, they are loaded from the application instead of the DLL. Fiasco!
It is possible to switch the context over to the DLL for the call, you will want to search for and read about - firstly - AfxSetResourceHandle and secondly AFX_MANAGE_STATE in MSDN.
|
|
|
|
|
Hi! I want to custom-draw menubar in MFC MDI. Is there anyway to get menubar m_hWnd so that we can hook WNDPROC. Thanks
|
|
|
|
|
The menu bar isn't traditionally a window. Don't try looking up Explorer or Internet Explorer using Spy++, though, as that will indicate a window handle... of a toolbar. Ditto Visual Studio and Office.
You can owner-draw menu items by adding the MFT_OWNERDRAW flag to the menu item using SetMenuItemInfo . Windows then sends the window WM_MEASUREITEM and WM_DRAWITEM messages.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
i am facing a weird problem
i am using XP icons imporitng them adding them to the imagelist attaching it with the ctreeview
m_ImageList.Create(16,16,ILC_COLOR32|ILC_MASK,4,4);
m_ImageList.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
GetTreeCtrl().SetImageList(&m_ImageList,TVSIL_NORMAL);
But the Icons don't show right (seems they are painted with less colors)
but he same code and same icons are wokring with CListCtrl just fine
any ideas , can CImagelist handle such icons it must cause CListCtrl is painting them just right
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
http://www.mastishk.com
|
|
|
|
|
Here is a snippet of code I wrote last month. It makes a CTreeview with a list of icons (big size) on the left with a description on the right side (2nd column). Dont forget, icons have 2 sizes, small and big. See if you can understand what I wrote:
CImageList * m_pImageList;
CImageList * m_pImageListSmall;
<view file="">
// insert two columns (REPORT mode) and modify the new header items
m_ctlDatabaseList.GetWindowRect(&rect);
m_ctlDatabaseList.InsertColumn(0, strItem1, LVCFMT_LEFT, rect.Width() * 3/9, 0);
//spaces them equally. This is a header of the CTree control
m_ctlDatabaseList.InsertColumn(1, strItem2, LVCFMT_LEFT, rect.Width() * 1/3, 1);
m_ctlDatabaseList.InsertColumn(2, strItem3, LVCFMT_LEFT, rect.Width() * 2/7, 2);
///create the icons
CRect rect;
CzScanApp *pApp;
pApp = (CzScanApp*)AfxGetApp();
m_pImageList = new CImageList();
m_pImageListSmall = new CImageList();
ASSERT(m_pImageList != NULL && m_pImageListSmall != NULL);// serious allocation failure checking
m_pImageList->Create(32, 32, TRUE, 4, 4); //This is a large icon
m_pImageListSmall->Create(16, 16, TRUE,4, 4);//this is the small icon from the same file
m_pImageList->Add(pApp->LoadIcon(IDI_ICON1));
//Icons have 2 sides to them, small size and large size
//.....ADD AS MANY ICONS YOU WANT SO LONG AS YOU HAVE THE ICON FILES STORED TO USE
m_pImageList->Add(pApp->LoadIcon(IDI_ICON50));
//Icons have 2 sides to them, small size and large size
///now add the icons to show
for (iItem = 0; iItem < Limit; iItem++) // insert the items and subitems into the list view.
{
if(GROUP[iItem+1][0].NoOfDACs== 0)
continue;
for (iSubItem = 0; iSubItem < 3; iSubItem++)
{
if (iSubItem == 0)
iIcon = ++a; // choose the icon and legend for the entry
lvitem.mask = LVIF_TEXT | (iSubItem == 0? LVIF_IMAGE : 0);
lvitem.iItem = (iSubItem == 0)? iItem : iActualItem;
lvitem.iSubItem = iSubItem;
// calculate the main and sub-item strings for the current item
pStrTemp1= strIconShortDesc[iIcon].GetBuffer(strIconShortDesc[iIcon].GetLength());
pStrTemp2= strIconDesc[iIcon].GetBuffer(strIconDesc[iIcon].GetLength());
pStrTemp3= strIcon3rdCol[iIcon].GetBuffer(strIcon3rdCol[iIcon].GetLength());
//lvitem.pszText = iSubItem == 0? pStrTemp1 : pStrTemp2;//2;
switch(iSubItem)
{
case 0:
lvitem.pszText = pStrTemp1;
break;
case 1:
lvitem.pszText = pStrTemp2;
break;
case 2:
lvitem.pszText = pStrTemp3;
break;
default:
break;
}
lvitem.iImage = iIcon;
if (iSubItem == 0)
iActualItem = m_ctlDatabaseList.InsertItem(&lvitem);
// HERE, IT INSERTS A NEW ICON WITH A DESCRIPTION
else
m_ctlDatabaseList.SetItem(&lvitem);
// HERE, IT MODIFIES AN EXISTING ICON WITH DESCRIPTION, (the sub-item text)
}//for(iSubItem
|
|
|
|
|
when test my program using rational purify it shows
memory leak.
the memory leak is shown in recv()
/* message, as shown by rational purify */
[W] MLK: Memory leak of 48 bytes from 1 block allocated in recv [WSOCK32.dll]
Distribution of leaked blocks
48 bytes from 1 block of 48 bytes (0x001bad90)
Allocation location
RtlAllocateHeap [NTDLL.DLL]
recv [WSOCK32.dll]
mainThread(void) [mainthread.h:70]
wndProc(HWND__ *,UINT,UINT,long) [wndproc.h:199]
PeekMessageA [USER32.dll]
msgLoop(void) [esme.cpp:61]
WinMain [esme.cpp:107]
WinMainCRTStartup [crt0.c:198]
/* in program */
BYTE bt[750];
int rcvd=0;
rcvd = recv(sckID,(char *)bt,500,0);
|
|
|
|
|
Did you call shutdown to close the connection (TCP only), closesocket to close the socket, and WSACleanup to clean up the Windows Sockets stack?
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hello,
I've just bought an AMD64 processor, and I'm coding a new console apps using CRT libraries, I need to get file size lenght but I don't know if I'm really low with skill coding (maybe) or if it's some problem with the architecture I've and the following code
<br />
long FileSize(FILE *fd)<br />
{<br />
long siz=0;<br />
if( fd == NULL)<br />
{<br />
return -1;<br />
}<br />
<br />
fseek (fd, 0, SEEK_END);<br />
siz=ftell(fd);<br />
rewind(fd);<br />
fclose(fd);<br />
<br />
return siz;<br />
};<br />
this piece of code is called at
<br />
wav->fd =fopen(argv[1],"rb");<br />
<br />
if(wav->fd == NULL)<br />
{<br />
printf("Unable to obtain an handle to %s\n",argv[1]);<br />
exit(-1);<br />
}<br />
strncpy((wav)->filename,argv[1],strlen(argv[1]));<br />
wav->filelenght =FileSize(wav->fd);<br />
in the main.
I always obtain 0... I just want to know if someone else is coding with AMD64 and has success with those API, thanks
|
|
|
|
|
I doubt your problem is the CPU.
Anyway, try removing or correcting this line. It is incorrect:
<br />
strncpy((wav)->filename,argv[1],strlen(argv[1]));<br />
Should be:
<br />
strncpy(wav->filename,argv[1],sizeof(wav->filename)-1);<br />
Bikram Singh
|
|
|
|
|
Hai All
please help me to track if a particular service is enabled or disabled in a particular host.
for ex:I installed norton internet security in a system.i need to know if the norton internet security is enabled or disabled because another program will run only if norton inetrnet security is disabled.
so please help me in the above problem.
Thanking you
rubin
|
|
|
|
|
helloo buddy i have created the applictaion that will handle this . you can give me your email address i will send you as early as possible
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
This is from MSDN:
DWORD StartSampleService() <br />
{ <br />
SERVICE_STATUS ssStatus; <br />
DWORD dwOldCheckPoint; <br />
DWORD dwStartTickCount;<br />
DWORD dwWaitTime;<br />
DWORD dwStatus;<br />
<br />
schService = OpenService( <br />
schSCManager,
"Sample_Srv",
SERVICE_ALL_ACCESS); <br />
<br />
if (schService == NULL) <br />
{ <br />
MyErrorExit("OpenService"); <br />
}<br />
<br />
if (!StartService(<br />
schService,
0,
NULL) )
{<br />
MyErrorExit("StartService"); <br />
}<br />
else <br />
{<br />
printf("Service start pending.\n"); <br />
}<br />
<br />
<br />
if (!QueryServiceStatus( <br />
schService,
&ssStatus) )
{<br />
MyErrorExit("QueryServiceStatus"); <br />
}<br />
<br />
<br />
dwStartTickCount = GetTickCount();<br />
dwOldCheckPoint = ssStatus.dwCheckPoint;<br />
<br />
while (ssStatus.dwCurrentState == SERVICE_START_PENDING) <br />
{ <br />
<br />
dwWaitTime = ssStatus.dwWaitHint / 10;<br />
<br />
if( dwWaitTime < 1000 )<br />
dwWaitTime = 1000;<br />
else if ( dwWaitTime > 10000 )<br />
dwWaitTime = 10000;<br />
<br />
Sleep( dwWaitTime );<br />
<br />
<br />
if (!QueryServiceStatus( <br />
schService,
&ssStatus) )
break; <br />
<br />
if ( ssStatus.dwCheckPoint > dwOldCheckPoint )<br />
{<br />
<br />
dwStartTickCount = GetTickCount():<br />
dwOldCheckPoint = ssStatus.dwCheckPoint;<br />
}<br />
else<br />
{<br />
if(GetTickCount()-dwStartTickCount > ssStatus.dwWaitHint)<br />
{<br />
break;<br />
}<br />
}<br />
} <br />
<br />
if (ssStatus.dwCurrentState == SERVICE_RUNNING) <br />
{<br />
printf("StartService SUCCESS.\n"); <br />
dwStatus = NO_ERROR;<br />
}<br />
else <br />
{ <br />
printf("\nService not started. \n");<br />
printf(" Current State: %d\n", ssStatus.dwCurrentState); <br />
printf(" Exit Code: %d\n", ssStatus.dwWin32ExitCode); <br />
printf(" Service Specific Exit Code: %d\n", <br />
ssStatus.dwServiceSpecificExitCode); <br />
printf(" Check Point: %d\n", ssStatus.dwCheckPoint); <br />
printf(" Wait Hint: %d\n", ssStatus.dwWaitHint); <br />
dwStatus = GetLastError();<br />
} <br />
<br />
CloseServiceHandle(schService); <br />
return dwStatus;<br />
}
Bikram Singh
|
|
|
|
|
Is there is any way to recieve windows message without DoModal the dialog box,but by creating the object of that class.
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
|
nope that i don't want i don't want to show dialog noe model nor modeless.
is any way to recieve window message without showing the modelor modelless dialog boxes.
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
The message mechanism builds on HWND s, so, for all practical purposes, no.
But there might be an alternative way, if you describe what you want to accomplish rather than how to accomplish it.
|
|
|
|
|
"first thanks for reply "
now let me explain my problem.
i am creating the window service(which is desktop interractive).i am also created Winlogon dll which notify me that some user is logged on or logged on the Work Station.
now problem arise to comuunicate between these two services i am using RegisterWindowMessage to pass information.
here the problem arise the Service can't receive a until dialog is displayed in case of modol dialog
and the in case of modelless dialog ,from wher i will get the desktop window pointer,without that it will not going to listen my registered message.
i think i have explained my problem
thanks,now any suggesstion
ps(socket create some problem in winlogon,so i can't use socket to sned or recieve message)
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
In this case, I would have tried a hidden modeless window. You normally don't need any pointers to the desktop window to get registered messages, why is that in your case?
|
|
|
|
|