|
mahdi_monhi wrote: I dont know this settings of MFC is the reason of Thread hang up.
It's possible. With MFC extension DLLs, you have to use the DLL version of MFC.
It's also possible to mix like you're doing but only with restrictions.
You also need to make sure you've initialized MFC properly in the DLLs.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
i developed a com addin for msword in MFC
i have done the registration issues for it ,and i added a menu item for invoking the addin functionality , so it is registered and working properly for a NEW word document.
the problem occurs when i OPEN an already saved word document, when i click the menu item the famous error message appears "Microsoft office word has encountered a problem and needs to close, we are sorry for the inconvience"
when i work on a new word document i can attach to the word process and debug, but when i work on an opened word document i can attach but the break points are not active
can anyone give me any hint??
thanks alot
|
|
|
|
|
one simple golden rule:
but iam not sure weather it suits for ur application.
if break points are getting disabled, then use some message boxes to localise the problem.
just try it.
you can even redirect the log to a file and observe it offline.
|
|
|
|
|
Dear All
How we can disable task manager for all the users of the system.
I know that we can do it for current user of system by registry. But I want a way to disable task manager for all the users of windows 2000 or windows XP system.
Regards
Monhi
|
|
|
|
|
i think Operating Systems / SysAdmin is the best place, where, this question can be put.
|
|
|
|
|
He wants to do this programmically using C++, not a scripting language. Is that something that is beyond this forum?
Any sufficiently advanced technology is indistinguishable from magic. Arthur C. Clarke
|
|
|
|
|
mahdi_monhi wrote: How we can disable task manager for all the users of the system
why?
Russell
|
|
|
|
|
Is it possible to get hwnd of the running program?
What i need is when someone triggers my app I need to known hvnd of the window from where he called my app!
Thanks
|
|
|
|
|
Will GetNextWindow or GetWindow help you?
- NS -
|
|
|
|
|
I need to get window with focus! Does focus change when hot-key is pressed and that event triggers my app? Anyway, my app. needs to get the pointer of the window who had the focus at time of triggering!
Thanks
-- modified at 4:15 Tuesday 4th September, 2007
|
|
|
|
|
I have written an TDI server program, which is not able to accept any connection although listen succeeds. Given below my sample code. Please help me in figuring out where i am wrong or if possible suggest me for some good source link.
NTSTATUS
Listen(PFILE_OBJECT FileObject) //UINT Addr
{
NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES;
PIRP Irp;
IO_STATUS_BLOCK IoStatus = {0};
PDEVICE_OBJECT DeviceObject;
char cBuffer[256] = {0};
char ack[20] = "ok";
PTRANSPORT_ADDRESS pTransportAddress = (PTRANSPORT_ADDRESS)&cBuffer;
TDI_CONNECTION_INFORMATION RequestConnectionInfo = {0};
TDI_CONNECTION_INFORMATION ReturnConnectionInfo = {0};
KEVENT Event;
DbgPrint("Inside listen");
KeInitializeEvent(&Event, NotificationEvent, FALSE);
DeviceObject = IoGetRelatedDeviceObject(FileObject);
Irp = TdiBuildInternalDeviceControlIrp(TDI_LISTEN, DeviceObject, FileObject,
&Event, &IoStatus);
if (Irp == 0)
{
DbgPrint("TDI_LISTEN .... failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
DbgPrint("TdiBuildInternalDeviceControl success");
RequestConnectionInfo.UserData = (PVOID) ack;
RequestConnectionInfo.UserDataLength = strlen(ack);
RequestConnectionInfo.Options = 0; //TDI_QUERY_ACCEPT;
RequestConnectionInfo.OptionsLength = sizeof(ULONG);
RequestConnectionInfo.RemoteAddress = NULL;
RequestConnectionInfo.RemoteAddressLength = 0;
DbgPrint("Before Delay");
delay(30);
TdiBuildListen(Irp, DeviceObject, FileObject, NULL, NULL, 0, &RequestConnectionInfo, &ReturnConnectionInfo);
DbgPrint("After TdiBuildListen");
Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); //UserMode
DbgPrint("Leaving TdiBuildListen");
return Status == STATUS_SUCCESS ? IoStatus.Status : Status;
}
/*
* accept
*/
NTSTATUS
Accept(PFILE_OBJECT FileObject)
{
/*
TA_IP_ADDRESS taIpAddress;
TDI_CONNECTION_INFORMATION tdiConnectionInformation;
RtlZeroMemory( &taIpAddress, sizeof( taIpAddress ) );
taIpAddress.TAAddressCount = 1;
taIpAddress.Address[ 0 ].AddressLength = TDI_ADDRESS_LENGTH_IP;
taIpAddress.Address[ 0 ].AddressType = TDI_ADDRESS_TYPE_IP;
RtlZeroMemory( &tdiConnectionInformation, sizeof( tdiConnectionInformation ));
tdiConnectionInformation.RemoteAddressLength = sizeof( taIpAddress );
tdiConnectionInformation.RemoteAddress = &taIpAddress;
*/
NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES;
PIRP Irp;
IO_STATUS_BLOCK IoStatus = {0};
PDEVICE_OBJECT DeviceObject;
char cBuffer[256] = {0};
PTDI_ADDRESS_IP pTdiAddressIp;
PTRANSPORT_ADDRESS pTransportAddress = (PTRANSPORT_ADDRESS)&cBuffer;
TDI_CONNECTION_INFORMATION RequestConnectionInfo = {0};
TDI_CONNECTION_INFORMATION ReturnConnectionInfo = {0};
KEVENT Event;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
DeviceObject = IoGetRelatedDeviceObject(FileObject);
DbgPrint("Inside Accept");
DbgPrint("Before TdiBuildInternalDeviceControlIrp");
delay(25);
Irp = TdiBuildInternalDeviceControlIrp(TDI_ACCEPT, DeviceObject, FileObject,
&Event, &IoStatus);
if (Irp == 0)
{
DbgPrint("Failure in TdiBuildInternalDeviceControlIrp");
return STATUS_INSUFFICIENT_RESOURCES;
}
DbgPrint("After TdiBuildInternalDeviceControlIrp");
pTransportAddress->TAAddressCount = 1;
pTransportAddress->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
pTransportAddress->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
pTdiAddressIp = (TDI_ADDRESS_IP *)&pTransportAddress->Address[0].Address;
pTdiAddressIp->sin_port = HTONS(PORT); //* Example: 1494 = 0x05D6 (Little Endian) or 0xD605 (Big Endian)
pTdiAddressIp->in_addr = INETADDR(10,6,21,20); //* Example: 10.60.2.159 = 0A.3C.02.9F (Little Endian) or 9F.02.3C.0A (Big Endian)
RequestConnectionInfo.UserData = NULL;
RequestConnectionInfo.UserDataLength = 0;
RequestConnectionInfo.Options = 0;
RequestConnectionInfo.OptionsLength = 0;
RequestConnectionInfo.RemoteAddress =(PVOID)pTransportAddress;
RequestConnectionInfo.RemoteAddressLength = sizeof(PTRANSPORT_ADDRESS) + sizeof(TDI_ADDRESS_IP);
DbgPrint("Before TdiBuildAccept");
delay(25);
TdiBuildAccept(Irp, DeviceObject, FileObject, NULL, NULL, &RequestConnectionInfo, &ReturnConnectionInfo);
DbgPrint("After TdiBuildAccept");
delay(25);
Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
Status = KeWaitForSingleObject(&Event, UserRequest, KernelMode, FALSE, 0);
DbgPrint("Leaving Accept");
delay(25);
return Status == STATUS_SUCCESS ? IoStatus.Status : Status;
}
With thanks in advance,
barun
barun
|
|
|
|
|
Hi All,
I am using listctrl in which I add JPEG images loading from images saves on hard disk.
To Set item in ListCtrl control I use SetItem() function as follows
CString pstr = "C:\\JPEG_image";
BOOL blnCheck = mWebPagePrvListCtrl.SetItemData(iItemindex,(DWORD)pstr);
But the above statement not set the value of pstr in ListCtrl.
To identify which images is click by user I use following code to access data of image.
as
int itemIndex = mWebPagePrvListCtrl.GetHotItem();
CString* pStr = (CString*) mWebPagePrvListCtrl.GetItemData(itemIndex);
Plz send me what is the problem in above code.
Thanks in Advance
Atul
|
|
|
|
|
CString pstr = "C:\\JPEG_image";
It is local, right?
- NS -
|
|
|
|
|
|
Atulmahajan wrote: Yes It is Local.
So I think you are mistaken.
Actually you are trying to save the image name along with each list control item, right? SetItemData is holding only a 4 byte value. We are using this to hold a pointer. Here in your case, it is a pointer to the string. Since the string is local when you exit from the function, the pointer will not be valid. So the stored pointer has no use.
One solution is that you can dynamically allocate the string in heap (using new CString). But need to delete the memory when you close the window, or delete the list control item.
Another method is that you can use a CStringArray object as member variable. Then you can store each string in the array and can keep the index in the list control item data. Here also removal of the string item from the array is needed, if you delete a list control item (just for saving the memory).
Hope you got the idea.
- NS -
|
|
|
|
|
How to import dll in to my vc++ 8.0 programme
I want to include the “dwlGina2.dll” in to my programme and to call all the function in the dll, iam new to dll,
so explain me briefly
regards
shakumar
shakumar
|
|
|
|
|
along with that dll, you should also have the corresponding .lib and .h.
do you have?
|
|
|
|
|
no
There is no .cpp ,.h file in the name of dll of file
shakumar
|
|
|
|
|
You can use of dll with load it on your program.
|
|
|
|
|
Hi all,
How can i know that the user has pressed ALT+F4 key combination .
Thanks in advance.
|
|
|
|
|
Hi,
for example in PreTranslateMessage :
if (msg->message == WM_KEYDOWN)
{
if(msg->wParam == VK_F4 && GetKeyState(VK_LMENU)<0)
{
}
}
I hope it works
|
|
|
|
|
baerten wrote: if(msg->wParam == VK_F4 && GetKeyState(VK_LMENU)<0)
You want it to work only if the Left Alt is pressed? I would rather suggest VK_MENU instead of VK_LMENU . Moreover, I doubt if this would ever work!
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Hi,
Its working. Thanks for ur reply
|
|
|
|
|
Handle WM_CLOSE and place the following code in it:
if(GetKeyState(VK_MENU)<0 && GetKeyState(VK_F4)<0)
{
AfxMessageBox("Alt and F4 keys are down!");
}
[I am assuming that you're working on a dialog based app and using MFC. Do reply if there's something different]
|
|
|
|
|
Hello everyone,
If I am developing a native unmanaged COM using Visual Studio 2005 C++, is it a mandatory to register type lib into HKEY_CLASSES_ROOT\TypeLib?
I have already registered related entries into HKEY_CLASSES_ROOT\CLSID\<co clas="" id="">, HKEY_CLASSES_ROOT\Interface\<interface id="" of="" co="" class="" exposed=""> and HKEY_CLASSES_ROOT\<co class="" name="">.
What is the function of the entry under HKEY_CLASSES_ROOT\TypeLib during COM object discovery and creation process?
thanks in advance,
George
|
|
|
|