|
|
|
I have been given the following example code but I have no idea how to call from Visual C.
NB I am the Scotweave end of the process.
Essentially I need to know how to post the HTTP request ?
Many thanks for any help.
dave
-------------
Example (ASP)
Example (ASP)
<%@language=Jscript%>
<%
var objSrvHTTP;
var objXMLSend;
objSrvHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP");
objXMLSend = Server.CreateObject("Msxml2.DOMDocument.3.0");
objXMLSend.async = false;
objXMLSend.loadXML ("<request>" +
"<xbnr>001" +
"<xplt>01" +
"<name>StockItem" +
"<type>getStockItemList" +
"StockItem" +
"<stockitem>" +
" <list>XANR" +
" <list>XARTBZ" +
"" +
"");
objSrvHTTP.open ("POST","http://{IP}/{APP}/jsiapi.jsp",false);
objSrvHTTP.send (objXMLSend);
Response.ContentType = "text/xml";
Response.Write (objSrvHTTP.responseText);
%>
The above example will call an existing Jomar process (StockItem.getStockItemList) passing a request XML (blow left). The JSIAPI interface will return a response XML (below right).
<request>
<xbnr>001
<xplt>01
<name>StockItem
<type>getStockItemList
StockItem
<stockitem>
<list>XANR
<list>XARTBZ
<response>
<stockitem>
<row>
<xanr>AGK1
<xartbz>Cashmere Scarf
<row>
<xanr>AGK2
<xartbz>Cashmere Scarf
<row>
<xanr>AGK3
<xartbz>Cashmere Scarf
<xbnr>001
<xplt>01
|
|
|
|
|
Dear all
I write one DLL program which creates one thread.
but when I call AfxBeginThread routine, I find that AfxBeginThread hangs and dont return.
When I trace the code , I find that , in THRDCORE.CPP at following line, my program hangs.
// start the thread just for MFC initialization
VERIFY(ResumeThread() != (DWORD)-1);
VERIFY(::WaitForSingleObject(startup.hEvent, INFINITE) == WAIT_OBJECT_0);
::CloseHandle(startup.hEvent);
at second VERIFY routine my program hangs up and waits for infinite.
I dont know the reason. but if you know please let me know.
Regards
Monhi
|
|
|
|
|
can you show me the code of your AfxBeginThread calling and hte thread function definition(sample is sufficient).
then i can suggest you something.
|
|
|
|
|
this is the line which I call in my program.
m_pMonitorThread_L = AfxBeginThread((AFX_THREADPROC) _LineEventProc, (void*)this);
|
|
|
|
|
how about the thread definition and declaration.
|
|
|
|
|
This Thread is created in one static library file.
static library file is included in one dll.
dll in loaded into another DLL.
DLL is loaded in one application.
I think that because of this consequence of dll loading, I get this error.
I use another scheme and dont get hang problem.
It is :
This Thread is created in one static library file.
static library file is used by one dll.
The dll is used by one application.
I think that MFC setting is not correct.
Regards
|
|
|
|
|
Is this DLL a valid MFC extension DLL?
If not, then you probably shouldn't be using MFC thread creation functions
and instead use the appropriate method:
If the DLL is linked to the multithreaded CRT, use _beginthread()/_beginthreadex()
else use the Windows CreateThread() API.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I have a dll which uses a static library in it . this dll is compiled with MFC support by static library.
A second DLL loads first dll. this second DLL is compiled with MFC support by dynamic link library.
I dont know this settings of MFC is the reason of Thread hang up.
Regards
Monhi
|
|
|
|
|
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 -
|
|
|
|