|
You need it in managed C++ ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I would prefer it in managed c++ or c#, failing that c/c++ would also be ok
do you have any tips/ideas/solutions?
|
|
|
|
|
I asked because most posts here are not for MC++ problems. I *think* DirectShow will do what you want, I looked into it ages ago. I'd recommend using C#, it's easier, and the underlying implimentation is going to do most of the work anyhow, so speed will not differ that much.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Dear All, does anyone have UDP socket sample code that can be send to me?. I need a code to tackle these questions:
a) Write and send a programme to send a single datagram.
b) a program to receive the datagram sent by the program (a above)
c) A program to wait for the reply from b above (question b)
d) A way of timing how long it takes for a datagram to get from the first program to the second and back again, i.e measuring the RTT of a datagram.
My email address is: jee_3000@yahoo.co.uk
Thank you for looking into this.
Regards.
|
|
|
|
|
|
I have a simple default C++ web service created with the wizards in Visual Studio .NET 2003:
#include "stdafx.h"
#include "blipwebClass.h"
#include "Global.asax.h"
#using <mscorlib.dll>
#using "BLIPSVRLib.dll"
using namespace BLIPSVR;
namespace blipweb
{
String __gc* blipwebClass::HelloWorld()
{
Interop::BLIPSVRLib::BlipClass *p = new Interop::BLIPSVRLib::BlipClass();
return(p->Puke());
}
};
I have added a reference to a simple ATL COM server I created with Visual Studio C++ 6.0 SP5 that exposes the BlipClass object and the method called 'Puke'. The minute you click the invoke button on the web service page, the page fails to come up and displays error 500 in the browser. If I do this from a Managed C++ console app, creating BlipClass and calling its Puke method works perfectly. Also, if I create a C# web service and add a reference to the BLIPSVRLib, creating the BlipClass object and calling its Puke method works perfectly. Why doesn't it work in a Managed C++ web service? Uggg!
Thanks in advance for any help,
Chris Disdero
Everett, WA USA
|
|
|
|
|
Hi!
System specs:
Language: C++
Compiler: Borland C++ 5.6 for Win32
OS: Windows Xp
App type: Console based application
I'm coding a Process-Lister program, where I try to output the DLLpath, ImagePathname and other strings gathered from the PEB block of each process..
This is (roughly) done in the way:
1) Read the start address of the RTL_USER_PROCESS_PARAMETER (RUPB*) from the PEB block. (offset = 0x010).
2) Read the UNICODE_STRING (US*) structure from the RUPB block (offset = depending on which field, ex: DLLPath = 0x030).
3) Read the Wide-character-string (UNICODE_STRING:Buffer) from the US block, (offset = 0x04), with the length (UNICODE_STRING:Length) bytes.
After this, I convert the read wide-character-string to a multibyte-string using the function WideCharToMultiByte.
Then I output it to the console using printf("%s\t",string)
The result is a lot of gibberish and makes no sense, I have tried changing the CodePage Identifier several times to several different types..
And still the problem remains...
Can someone help me? Or explain why? Iv'e been stuck with this problem for days now... And It's really getting to me..
See code below..
The following code demonstrates how I try to get the text from the UNICODE_STRING structure in the memory.....
<<-----CODE
.
.
UNICODE_STRING buff;
DWORD read;
if(ReadProcessMemory(process, (void *) address, &buff, 8, &read) == 0)
return;
if(buff.Length == 0)
return;
int str_size = buff.Length;
wchar_t *wchar_str = new wchar_t[str_size];
if(ReadProcessMemory(process, (void *) (address+4), wchar_str, str_size, &read) == 0){
RAP_ERROR(read);
return;
}
unsigned int codePage = 28591 //IS0-8859-1
unsigned int flag = 0;
int needed_for_trans = WideCharToMultiByte(codePage,flag, (LPCWSTR) wchar_str,-1,NULL,0,NULL,NULL);
char *multi_str = (char *)malloc(needed_for_trans);
int transed_bytes = 0;
if( (transed_bytes = WideCharToMultiByte(codePage, flag, (LPCWSTR) wchar_str, -1, multi_str, needed_for_trans, NULL, NULL)) == 0)
RAP_ERROR(read);
cout << "#DATA:";
int s = printf("%s\t", multi_str);
cout << "S:" << s << "\t";
cout << "¤BYTE:" << "[" << read << " | " << transed_bytes << endl;
delete[] wchar_str;
free(multi_str);
.
.
<<----------------------------------------------------
There is the critical piece ....
Now,, I would be REALLY glad if someone would help me....
The output from the printf is real gibberish....
And I don't understand why??
Thanks/ Gianfranco Alongi
/zen
|
|
|
|
|
Problem solved!!!!!
Fix:
I was treating the (LPWSTR) Buffer member of the UNICODE_STRING structure
as the actuall String, instead of a pointer to the WSTR.
Thanx annyway!
|
|
|
|
|
Hello, I am currently working on a project that includes creating a Server and an Client Progam.
My compiler (Who hates me because I got for free out of a Library book) often gives me errors that I cannot fix, an example being an undefined reference to WSAstartup(). My question is, should I invest in a "real" compiler for probably around $700 or could someone please lend me a copy of their C++ header files for creating Windows Sockets. (If that is at all legal of course, I wouldn't know)
Side Note:
Yes, I have looked in the guides and tutorials on CodeProject and have found nothing that, even with my modification, will satisfy my compiler's needs.
|
|
|
|
|
*sigh*
1. the header files won't help you. Downloading the platform SDK probably will
2. this question is not pertinent to MC++, you're asking in the wrong forum.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
WSA socket functions are Micrisift specifics, and you will be certain to have an error if you call such functions through a compiler that don't know them at all.
installing the SDK might probably help you to fix these errors.
> why not developping your own compiler ?!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Assignment
Write a program in C++ and WIN32 api to implement an unnamed pipe. program should contain two threads ("producer" and "consumer") communicating through a pipe which is implmented using an array having 10 entries( ie 0 to 9). access to the pipe should be synchronized using a semaohore implemented as a " class" .The "p" and "v" operations supported by the semaphore should be exucuted "ATOMICALLY" Which is enforced using WIN32 API functions (e.g the createsemaphore funtion).
NOTE The P and V are the only operations supported by the semaphore class.
The poducer thread gets an integer ( a single digi, 0.....9) from the user and enqueues it into the pipe . The consumer thread always dequeues the first number in the pipe toward the front of the pipe after an item has been deposited ( by the producer) or consumed ( by the consumer)
We should use another "class" (ie the pipe class) to implement the pipe supporting operations " enqueue", "dequeue" and "move". The fisrt two operations have to be synchronized using the semaphore shown above (operation"move " is not because it is invoked by the first two operatios which can directl acces the shared pipe)
Note that your pogram should also be able to take care of the conditions when the pipe is either empty or full.When the consumer thread detects an empty pipe ,it prints a message to the screen.similarl when the producer thread detects afull pipe ,it prints a message to the screen too.
Note also that you should alwas delay the consumer thread by three 3 seconds by inserting a "sleep3000)" (without qoutes ) function into the appropriate place in the consumer thread.
The producer thread shold also show the contents of the pipe after a number is enqueued .
The consumer shouls aslso show the contents of the pipe after a number is dequeued .
The following shows the scenario of running program, where user inputs are underlined
enter a number: 5the
contents of the pipe (from the producer):bbbbbbbbb5
enter a number:2
the contents of the pipe(from producer):bbbbbbbb25
the contents of the pipe (from consumer);bbbbbbbbb2
enter a number:7
the contents of the pipe (from producer):bbbbbbbb72
the contents of the pipe (from consumer):bbbbbbbbb7
enter a number:
the contents of a pipe ( from consumer):bbbbbbbbbb
... an empty pipe is detected (from consumer):\\\
..................
|
|
|
|
|
1. Welcome to the academic world. You have two options. Either pay someone to do your homework now, and for the rest of your academic career, then go back to flipping burgers ( seeing as you will have learned nothing ), or try to do your own homework and ask for help when you get stuck. If you decide to fail your course, I'll do this program for you for $50. My fee for the next one will be $100, and so on. If you decide to learn for yourself, I'll be happy to help for free. That means you try first, and ask SPECIFIC questions when you get stuck.
2. This is the Managed C++ forum. Nothing about this assignment looks to me like MC++
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian said:
"If you decide to fail your course, I'll do this program for you for $50. My fee for the next one will be $100, and so on."
Hey, you are cheap!
And I was ready to bill him my usual rate of $250/hour to do his assignment for him!
Christian also said:
"If you decide to learn for yourself, I'll be happy to help for free. That means you try first, and ask SPECIFIC questions when you get stuck."
Exactly! No problem giving specific help, if stuck. I used to tutor Comp Sci in college, as well as work in the computer lab as a lab assistent (that was many years ago), and many times I've had other students want me to do thier assignments for them. It they where truly stuck and did not know how to get started, I did not mind giving some hints to help get them on thier way, but I was not about to do thier homework for them.
|
|
|
|
|
skonopa wrote:
Hey, you are cheap!
Hell, no. My fee does not increase by $50, it doubles every time. Every assignment.
skonopa wrote:
It they where truly stuck and did not know how to get started, I did not mind giving some hints to help get them on thier way, but I was not about to do thier homework for them.
Yeah, that's exactly my point, too.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi
I am developing a MDI application where I would like to be able to control
the activeChild form from buttons on the MdiParent toolbar.
For example navigate through records in the dataset of the activeChild form.
I would like to use the same buttons on the MdiParent tool bar for any
activeChild form that is open.
How would I accomplish this? (C#/C++ please)
Thanks,
JoseTA
FranTA
|
|
|
|
|
Hi,
I have been succesful using single statement of DllImportAttribute to use my unmanaged Dll code. But, now I want to have 2 entrys in my Dll, so I wrote two DllImportAttribute Statements:
[System::Runtime::InteropServices:llImportAttribute
("D:\\Tumego\\MultiWayTree\\VBMGUM_DLL\\Debug\\VBMGUM_DLL.dll", _
CharSet =CharSet::Auto)]
extern int GetValue1000(void);
//
[System::Runtime::InteropServices:llImportAttribute
("D:\\Tumego\\MultiWayTree\\VBMGUM_DLL\\Debug\\VBMGUM_DLL.dll", _
CharSet =CharSet::Auto)]
extern int GetValue99(void);
The Error messages are:
BMGUM_MG.cpp(16) : error C2363: ?argument? '"_\r\nCharSet"="CharSet::Auto"' (?Custom Attribute? 'System::Runtime::InteropServices:llImportAttribute') ?Can not be evaluated?
VBMGUM_MG.cpp(13) : error C3725: 'System::Runtime::InteropServices:llImportAttribute': ? Can not interpret overloading of attribute?
?it might be ?'System::Runtime::InteropServices:llImportAttribute:llImportAttribute(System::String __gc *)'
*****?----? is not exact but is translated from Japanese Version Visual Studio ***********
Writing multiple DllImportAttribute Statement like this is fine:
even I can use using namespace:
using namespace System::Runtime::InteropServices;
[DllImportAttribute("Kernel32.dll", CharSet=CharSet::Auto)]
extern "C" int QueryPerformanceFrequency(__int64* Freq);
[DllImportAttribute("Kernel32.dll", CharSet=CharSet::Auto)]
extern "C" int QueryPerformanceCounter(__int64* Tw);
I do not like Dll expression of "D:\\Tumego\\MultiWayTree\\VBMGUM_DLL\\Debug\\VBMGUM_DLL.dll", becasuse of manageing difficulty. But I do not know other way. May be this expression is the reason for trouble.
The rest of the codes:
DLL simplified finnally like this:
int GetValue1000(void)
{
int a = 1000;
return a;
}
int GetValue99(void)
{
int a =99;
return 99;
}
Definition file:
LIBRARY VBMGUM_DLL
EXPORTS
GetValue1000
GetValue99
Any hints, comments and May-be answers are appreciated, as well as final shot.
Please help me.
|
|
|
|
|
Hi
I came to a work around and I thought it may help some having the same problem, I read MSDN >.NET_Framework > Programming > co-operation with Unmanaged Code.
There is a Sample that donot spell 'DllImportAttribute' but spells 'DllImport' also NO 'CharSet=CharSet::Auto' specification.
For the time-being it happend to be OK for me.
After I elliminated 'CharSet=CharSet::Auto', I donot get strange errors.
Thank you.
Chkky
|
|
|
|
|
Hi,
I asked this question before in the VC++ forum, but I think my question was misunderstood. I´ll try it again with more explanation...
I´m making an Windows Form appl. using VC++ .Net 2003. As I start an "Form" is automatically created for me.
Then I want to make my own "MessageBox"-like class (due to interference with the "windows.h" header I cannot use the included MessageBox" properly.)
I go to Project->Add new Item->Windows Form (.NET) and a new "Form" is created, that I want to use as a dialog box, and I add a Label and an OK-button rto it.
In the Forms properties I set:
FormBorterStyle = FixedDialog
MaximizeBox = False
MinimizeBox = False
However, I don´t know which property I must set, or which method to call for making the Form close when I push the OK-button.
Does anybody have a suggestion?
(I display it by calling the ShowDialog() method.)
Apart from that it works as a dialogbox (I know there are probably better ways to solve the problem, but I´m quite new to VC/C++, and this seemed like the easiest way around it)
regards
doneirik
|
|
|
|
|
I believe if you call the button IDOK, it will do this for you. If not, then there's a property for what button is the OK button, but the name escapes me. At least, that's the case in C#.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
For your MessageBox problem...
In stdafx.h just add #undef MessageBoxA or MessageBox don't remember.
To close your dialog take a look at this and I'm going to help you a bit...
// Set the accept button of the form to button1.
form1->AcceptButton = button1;
|
|
|
|
|
Hi
i am right now doing a project on E - Learning Development Tool Software.
I faced some problems on whether to create projects individually first then transfer it into a DLL, or just do the coding in the DLL?
Jingpo
|
|
|
|
|
I thik you should decide wich way works the best for you. Anyway, I would choose creating projects individually.
--Nikola--
modified 7-Dec-20 21:01pm.
|
|
|
|
|
Hi there, can someone tell me where' a syntax error in that code on line 16.
<br />
#pragma once<br />
<br />
using namespace System;<br />
using namespace System::Windows::Forms;<br />
using namespace System::Collections;<br />
using namespace System::Net;<br />
using namespace System::Net::Sockets;<br />
using namespace System::Data::Odbc;<br />
using namespace System::Text;<br />
<br />
#include "MessagesCodes.h"<br />
#include "Utilities.h"<br />
<br />
__gc class CServer<br />
{<br />
public:<br />
CServer(TextBox* p_txtServerEvents, TextBox* p_txtUsersMessages);<br />
~CServer(void);<br />
<br />
void DecodeMsg(SocketChatClient* p_client, String* p_msg);
<br />
String* GetServerName();<br />
String* GetServerAddress();<br />
int GetServerPort();<br />
<br />
bool GetHost();<br />
void CreateSocket();<br />
<br />
void OnConnectRequest(IAsyncResult* p_ar);<br />
void NewConnection(Socket* p_clientSocket);<br />
void OnReceivedData(IAsyncResult* p_ar);<br />
<br />
private:<br />
String* m_hostName;<br />
IPAddress* m_addr;<br />
const static int PORT= 3050;<br />
Socket* m_serverSocket;<br />
ArrayList* m_arrClients;<br />
TextBox* m_txtServerEvents;<br />
TextBox* m_txtUsersMessages;<br />
<br />
__gc class SocketChatClient<br />
{<br />
public:<br />
SocketChatClient(Socket* p_sock);<br />
<br />
Socket* GetSock() { return m_sock; }<br />
void SetupReceiveCallback(CServer* p_server);<br />
Byte GetReceivedData(IAsyncResult* p_ar)[];<br />
<br />
private:<br />
Socket* m_sock;<br />
Byte m_byBuff[];<br />
};<br />
};<br />
I think the problem is that the compiler don't see the internal class SocketChatClient but I don't know how to correct it.
--------------
The Thruth Is Out There
|
|
|
|
|
have you tried moving the definition of SocketChatClient to the beginning of your CServer class?
that way it is defined before it is referenced...
__gc class CServer
{
__gc class SocketChatClient
{
public:
SocketChatClient(Socket* p_sock);
Socket* GetSock() { return m_sock; }
void SetupReceiveCallback(CServer* p_server);
Byte GetReceivedData(IAsyncResult* p_ar)[];
private:
Socket* m_sock;
Byte m_byBuff[];
};
public:
CServer(TextBox* p_txtServerEvents, TextBox* p_txtUsersMessages);
~CServer(void);
void DecodeMsg(SocketChatClient* p_client, String* p_msg);
String* GetServerName();
String* GetServerAddress();
int GetServerPort();
bool GetHost();
void CreateSocket();
void OnConnectRequest(IAsyncResult* p_ar);
void NewConnection(Socket* p_clientSocket);
void OnReceivedData(IAsyncResult* p_ar);
private:
String* m_hostName;
IPAddress* m_addr;
const static int PORT= 3050;
Socket* m_serverSocket;
ArrayList* m_arrClients;
TextBox* m_txtServerEvents;
TextBox* m_txtUsersMessages;
};
Steve
|
|
|
|
|