|
Ian Darling wrote:
MFC isn't in my experience particularly slow, as most of the calls in MFC are pretty "thin" and usually go straight into the matching Win32 calls anyway.
Yes and The MFC Message Routing architecture is faster in some cases than a standard switch..case statement in WIN32
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
I really like the class because it's so easy to use. However i have a few problems with alpha
Creating an image with:
MyImage.Create(width, height, 32, CImage::createAlphaChannel);
Results in no alpha at all and when creating like this:
MyImage.CreateEx(width, height, 32, BI_RGB, 0,CImage::createAlphaChannel);
i get a completely transparent Image even if i set every pixel to 0xffffffff.
|
|
|
|
|
Hi guys,
I use a Static Text (CEdit) as an description to an Edit Control box. I want to be able to select the text in the Edit Control box when the Static Text is clicked (whether single or double click) using mouse. I tried to add mouse click type of event handlers of the Static text. Unforunately there seems to be 0 event handlers avaiable for Static Text.
Is that the case? If so, what can I do to acheive that (I am thinking to add a different component on the top of the Static Text but make it transparent).
Please help,
Thanks in advance
|
|
|
|
|
One possible solution is to add a mouse click message to the parent window. Determine whether the mouse pointer is within the coordinates of the static text box vis PtInRect().
Kuphryn
|
|
|
|
|
|
Michael Dunn wrote:
Set the Notify style on the static control. Then when you click it, it will send a STN_CLICKED notification to its parent.
Thanks guys,
The Nofity Style seems to be much more straight and is what I have chosen to use. Works well.
Thanks again
|
|
|
|
|
Hi all...
Does any1 know how can I create win32 window in perl
|
|
|
|
|
Read the documentation of perl.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Hi,
I created an ATL service and added an interface to it (STA)
Now, from my client application i am creating the interface and calling one of its method, after that method call is over the service gets terminated,
Any one knows why?
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Hi!
Can anyone tel me what exactly is the callback function. Its role or purpose.
Thanks
|
|
|
|
|
A callback function is a function you pass to a second function using a function pointer. The second function calls the callback function one or more times to perform some operation.
An example of the second function is the Win32 API function EnumWindows . It has the following prototype:
BOOL EnumWindows(WNDENUMPROC lpEnumFunc,
LPARAM lParam); EnumWindows enumerates all top-level windows on the screen. The first argument, lpEnumFunc , is a pointer to a callback function that you supply. An example is this:
BOOL CALLBACK MyEnumFunc(HWND hwnd,
LPARAM lParam)
{
char text[128];
::GetWindowText(hwnd,text,sizeof(text));
if (!strcmp(text,"Some Window Title")) {
}
} And you would call EnumWindows as follows:
EnumWindows(MyEnumFunc,0); Your callback function MyEnumFunc would then be called for every top-level window on the screen.
Software Zen: delete this;
|
|
|
|
|
Hi,
I am a beginner and am trying to use CObList to create a double linked list of CObject dervied class CHAN which has 3 member variables.The code for that is:
code <
class Chan:public CObject
{
public:
CString name;
int hdl;
bool status;
Chan(){hdl=0;status=true;};
Chan(CString nm,int hl,bool stat) {name=nm;hdl=hl;status=stat;};
Displ(){char disp[50];
sprintf(disp,"For %s hdl=%d and status is %s",name,hdl,status);
MessageBox(0,disp,"DISPLAY",MB_OK);
};
const Chan& operator=( const Chan& a )
{name=a.name;hdl=a.hdl;status=a.status;return *this;
}
};
>
My application is a dialog based application where i have created a list of size 10 and initialisingit in teh initInstance of teh application like this:
code <chan c("abx01234",0,true);
for(int="" i="0;i<11;i++)
{list.AddHead(&c);}">
In tehDialog applciation i wantto add/modify or delete the value of 2memeber variabels of Chan based on teh first value.
Please help out.Thank you
ananya
|
|
|
|
|
After Going through ur post 3 times and then figuring out that teh actually means the
This might Help
Everytime you have to Modify one Object you will have to search the whole list and find the one which you want to Modify
POSITION pos = list.GetHeadPosition();
for (int i=0;i < list.GetCount();i++)
{
Chan *pChan = list.GetNext(pos);
if(pChan->name == "STRING TO TEST")
{
}
}
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Hi!
I've created a SDI application with the new CHtmlEditView and CHtmlEditDoc classes for my document/view.
In my derived CHtmlEditView class, I have overrided functions OnKillFocus and OnChar to intercept the WM_CHAR and WM_KILLFOCUS messages.
But my view (and my main frame) doesn't got theses messages.
How to intercept this kind of messages in a such document/view type? Is there any special thing to add, in order to intercept theses messages in an HtmlEdit control?
Thks in advance!
Appstmd
http://www.appstmd.com
|
|
|
|
|
Post the code that specifies the program wants to handle those messages in the view and main frame classes.
It is very possible to handle those messages in both the view and main frame.
Kuphryn
|
|
|
|
|
Thks! But with the code added in both the view and the main frame, I don't receive the WM_CHAR message.
Here is my code from my CView and CMainFrame classes:
<br />
<br />
#include "stdafx.h"<br />
#include "Focus3.h"<br />
<br />
#include "MainFrm.h"<br />
#include ".\mainfrm.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#endif<br />
<br />
<br />
<br />
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)<br />
<br />
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)<br />
ON_WM_CREATE()<br />
ON_WM_CHAR()<br />
ON_WM_KILLFOCUS()<br />
END_MESSAGE_MAP()<br />
<br />
static UINT indicators[] =<br />
{<br />
ID_SEPARATOR, <br />
ID_INDICATOR_CAPS,<br />
ID_INDICATOR_NUM,<br />
ID_INDICATOR_SCRL,<br />
};<br />
<br />
<br />
.....<br />
<br />
void CMainFrame::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)<br />
{<br />
AfxMessageBox ("OnChar");<br />
<br />
CFrameWnd::OnChar(nChar, nRepCnt, nFlags);<br />
}<br />
<br />
...<br />
and my CView class:
<br />
<br />
#include "stdafx.h"<br />
#include "Focus3.h"<br />
<br />
#include "Focus3Doc.h"<br />
#include "Focus3View.h"<br />
#include ".\focus3view.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#endif<br />
<br />
<br />
<br />
IMPLEMENT_DYNCREATE(CFocus3View, CHtmlEditView)<br />
<br />
BEGIN_MESSAGE_MAP(CFocus3View, CHtmlEditView)<br />
ON_COMMAND(ID_FILE_PRINT, CHtmlEditView::OnFilePrint)<br />
ON_WM_SETFOCUS()<br />
ON_WM_KILLFOCUS()<br />
ON_WM_CHAR()<br />
END_MESSAGE_MAP()<br />
<br />
BEGIN_DHTMLEDITING_CMDMAP(CFocus3View)<br />
DHTMLEDITING_CMD_ENTRY(ID_EDIT_COPY, IDM_COPY)<br />
DHTMLEDITING_CMD_ENTRY(ID_EDIT_CUT, IDM_CUT)<br />
DHTMLEDITING_CMD_ENTRY(ID_EDIT_PASTE, IDM_PASTE)<br />
DHTMLEDITING_CMD_ENTRY(ID_EDIT_UNDO, IDM_UNDO)<br />
END_DHTMLEDITING_CMDMAP()<br />
<br />
<br />
......<br />
<br />
void CFocus3View::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)<br />
{<br />
AfxMessageBox ("OnChar");<br />
<br />
CHtmlEditView::OnChar(nChar, nRepCnt, nFlags);<br />
}<br />
Thks in advance!
Appstmd
http://www.appstmd.com
|
|
|
|
|
Who can tell me how to derive a class from ScrollBar, then this class can have a image interface?
If anybody can give me a example, i will feel very lucky.
Thank you very much.
|
|
|
|
|
Might just come in Handy
Click ME[^]
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
hello everybody,
here is a problem..
how to enumerate the name & it's IP addresses of devices(both Input & Output) in the personal system as well as to the network using WIN32 APIs & VC++ ???
if any body have snipet of code ,please give ...
thanking
skpanda
|
|
|
|
|
hello sir,
here is the bit clarification what i need actually.
i have to enumerate all the devices(both input as well as output devices) like printer,cdrom,flopy disk,monitor,keyboard,mouse etc... .with all the network resources like switch,modem,router...etc...
i have to enumerate these with IP address or without ...if it is not available with name .so please carify which win32 api function is suitable to this...please inform me earlier...
here r some function which i have gone through msdn
wnetenumresource
WNetOpenEnum
shall i use these...
if yes how just give me a snipet of code ....
waiting
skpanda
|
|
|
|
|
is the function call in main correct ???
please rectify it...
// iodevices.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
#include "Winnetwk.h"
//#include "display.h"
BOOL WINAPI NetErrorHandler(HWND hwnd,
DWORD dwErrorCode,
LPSTR lpszFunction);
BOOL WINAPI EnumerateFunc(HWND hwnd,
HDC hdc,
LPNETRESOURCE lpnr);
int main(int argc, char* argv[])
{
// NETRESOURCE nr;
EnumerateFunc(NULL,NULL,NULL);
return 0;
}
BOOL WINAPI NetErrorHandler(HWND hwnd,
DWORD dwErrorCode,
LPSTR lpszFunction)
{
DWORD dwWNetResult, dwLastError;
CHAR szError[256];
CHAR szCaption[256];
CHAR szDescription[256];
CHAR szProvider[256];
// The following code performs standard error-handling.
if (dwErrorCode != ERROR_EXTENDED_ERROR)
{
wsprintf((LPSTR) szError, "%s failed; \nResult is %ld",
lpszFunction, dwErrorCode);
wsprintf((LPSTR) szCaption, "%s error", lpszFunction);
MessageBox(hwnd, (LPSTR) szError, (LPSTR) szCaption, MB_OK);
return TRUE;
}
// The following code performs error-handling when the
// ERROR_EXTENDED_ERROR return value indicates that the
// WNetGetLastError function can retrieve additional information.
else
{
dwWNetResult = WNetGetLastError(&dwLastError, // error code
(LPSTR) szDescription, // buffer for error description
sizeof(szDescription), // size of error buffer
(LPSTR) szProvider, // buffer for provider name
sizeof(szProvider)); // size of name buffer
//
// Process errors.
//
if(dwWNetResult != NO_ERROR) {
wsprintf((LPSTR) szError,
"WNetGetLastError failed; error %ld", dwWNetResult);
MessageBox(hwnd, (LPSTR) szError,
"WNetGetLastError", MB_OK);
return FALSE;
}
//
// Otherwise, print the additional error information.
//
wsprintf((LPSTR) szError,
"%s failed with code %ld;\n%s",
(LPSTR) szProvider, dwLastError, (LPSTR) szDescription);
wsprintf((LPSTR) szCaption, "%s error", lpszFunction);
MessageBox(hwnd, (LPSTR) szError, (LPSTR) szCaption, MB_OK);
return TRUE;
}
}
BOOL WINAPI EnumerateFunc(HWND hwnd,
HDC hdc,
LPNETRESOURCE lpnr)
{
DWORD dwResult, dwResultEnum;
HANDLE hEnum;
DWORD cbBuffer = 16384; // 16K is a good size
DWORD cEntries = -1; // enumerate all possible entries
LPNETRESOURCE lpnrLocal; // pointer to enumerated structures
DWORD i;
//
// Call the WNetOpenEnum function to begin the enumeration.
//
dwResult = WNetOpenEnum(RESOURCE_CONNECTED, // all network resources
RESOURCETYPE_ANY, // all resources
0, // enumerate all resources
NULL, // NULL first time the function is called
&hEnum); // handle to the resource
if (dwResult != NO_ERROR)
{
//
// Process errors with an application-defined error handler.
//
NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetOpenEnum");
return FALSE;
}
//
// Call the GlobalAlloc function to allocate resources.
//
lpnrLocal = (LPNETRESOURCE) GlobalAlloc(GPTR, cbBuffer);
do
{
//
// Initialize the buffer.
//
ZeroMemory(lpnrLocal, cbBuffer);
//
// Call the WNetEnumResource function to continue
// the enumeration.
//
dwResultEnum = WNetEnumResource(hEnum, // resource handle
&cEntries, // defined locally as -1
lpnrLocal, // LPNETRESOURCE
&cbBuffer); // buffer size
//
// If the call succeeds, loop through the structures.
//
if (dwResultEnum == NO_ERROR)
{
for(i = 0; i < cEntries; i++)
{
// Call an application-defined function to
// display the contents of the NETRESOURCE structures.
//
// DisplayStruct(hdc, &lpnrLocal[i]);
// If the NETRESOURCE structure represents a container resource,
// call the EnumerateFunc function recursively.
if(RESOURCEUSAGE_CONTAINER == (lpnrLocal[i].dwUsage
& RESOURCEUSAGE_CONTAINER))
if(!EnumerateFunc(hwnd, hdc, &lpnrLocal[i]))
TextOut(hdc, 10, 10, "EnumerateFunc returned FALSE.", 29);
}
}
// Process errors.
//
else if (dwResultEnum != ERROR_NO_MORE_ITEMS)
{
NetErrorHandler(hwnd, dwResultEnum, (LPSTR)"WNetEnumResource");
break;
}
}
//
// End do.
//
while(dwResultEnum != ERROR_NO_MORE_ITEMS);
//
// Call the GlobalFree function to free the memory.
//
GlobalFree((HGLOBAL)lpnrLocal);
//
// Call WNetCloseEnum to end the enumeration.
//
dwResult = WNetCloseEnum(hEnum);
if(dwResult != NO_ERROR)
{
//
// Process errors.
//
NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetCloseEnum");
return FALSE;
}
return TRUE;
}
skpanda
|
|
|
|
|
Pande ji ,
try this
Click ME[^]
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
hello monty sir,
Click Me[^] is not working ...
please give the url correctly and please tell me how to enumerate all input /output devices in a network as well as local computer ...where the application is running...
waiting your response now ...
skpanda
|
|
|
|
|
|
hello,
but i want to enumerate all network resources, like SWITCH,ROUTER connected , etc....how to do that ??any idea ??
please guide...
thanking u ...
skpanda
|
|
|
|
|