|
Time to start learning then.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Richard,
If this is all you have to contribute, to people asking for assistance, then you should refrain from wasting the bits and space.
|
|
|
|
|
You commented that you know nothing about managed C++, as if we can somehow resolve that for you. I was merely suggesting what you need to do if you want to understand the problem you are reporting.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
igotmymtv2005 wrote: If this is all you have to contribute, to people asking for assistance, then you
should refrain from wasting the bits and space.
If you want to learn about using unmanaged code then you MUST learn about the many, many ways in which C++ can fail due to pointer problems.
Those are probably the most significant problem that an experienced C++ programmer will face (given that they will have overcome syntax and basic semantic errors.)
An inexperienced programmers will run across them too even though it is based on simple misused of something.
|
|
|
|
|
Hi, dear all,
I have a DLL created in C++ in 2008 .NET, it exports a function to be used by many other applications.
Now I have a application also created in C++ in VS2008, I need to call that function from DLL, how can I do it? also the DLL file path is come from my application argument list.
Thanks!
|
|
|
|
|
Have you done the same in VC6?
|
|
|
|
|
Hi
To get the symbol @ for example, I must press two buttons at seem time [Alt Gr] + [button with a and 0 near the backspace button]. So actually my application didn't support keys combination, so when I press this combination I get letter 'a' instead of symbol '@'. I am using VCE 2008. Here is the function I am using :
LRESULT WINAPI EventKey(int nCode, WPARAM wParam, LPARAM lParam)
{
if( (nCode == HC_ACTION) && ( (wParam == WM_SYSKEYDOWN) || (wParam == WM_KEYDOWN) ))
{
kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
nChar = getKeyFromvcode(kbdStruct.vkCode, (PWCHAR)&outputChar, (PWCHAR)&deadChar);
if(nChar > 0){}
}
return CallNextHookEx(hKeyHook, nCode, wParam, lParam);
}
How can I tell the application to convert keys combinations to its associated letters or symbols ?
Regards
|
|
|
|
|
|
Hi Friend i have a small doubt,
Can any one clear this issue.
CRecordset::GetFieldValue( LPCTSTR lpszName, CString& strValue );
at what condition it throws CMemoryException,
|
|
|
|
|
Please tell me how to search for a word in a text file in visual c++. Kinda know that I have to use string object and IndexOf? Please, help!!
|
|
|
|
|
byank wrote: Kinda know that I have to use string object and IndexOf?
So what is your problem? Have you considered using the FindInFiles() [^] method?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I'm trying to search for word in a text file which is loaded in a richtextbox in my windows form app. I've seen some code but it was in vb and i need it in c++.
i'll place the word that's gonna be searched for in a textbox and after i click a button i should see if the words exists and where it is. any help is appreciated.
modified 19-Jul-12 17:29pm.
|
|
|
|
|
If you already have the text loaded in the RichTextBox [^] then you can use any of the Find() methods to do it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi All,
I want to covert a string to integer.Consider the string as char str[10]; and integer as int num; My case is as following:-
1) Suppose str = "10"
num should be = 10
2) Suppose str = "10.88"
num should be 0 or any invalid number so that we can identify that its not an integer but any other value.
3) Suppose str = "10ab"
num should be 0 or any invalid number so that we can identify that its not an integer but any other value.
Is there any direct API by which we can identify the above cases. I have tried atoi() but it returns the remaining integer value after removing the float or alphanumeric values.
Or
I have to try it by creating my own method.
|
|
|
|
|
Since this is the C++/CLI forum, I'll give you a Managed reply -- use the TryParse static method on Int32 and/or Double classes.
int val;
String^ s = "10.22";
if (System::Int32::TryParse(s,val))
else
John
modified 17-Jul-12 10:24am.
|
|
|
|
|
Thanks John for your reply. I am sorry I posted this thread in C++/CLI forum. Actually I was looking for a solution in C++/MFC.
Sorry for the inconvinience.
Cheers,
Abinash
|
|
|
|
|
Read char by char in a file after write char by char to another file in vc++.
Can any one reply me.
Thanks,
lucky.
|
|
|
|
|
|
I need to pass a managed callback to an unmanaged TCP receiver. Since its a thread that needs to exist for the lifetime of the application, I need to prevent it from getting garbage collected. I have read everywhere that pinning function pointers is not required and the GCHandle.Alloc will do the job of preventing garbage collection.
But is this a given? I have seen that the AppPool hosting this code crashes with an access violation. Why should I not suspect the fact that this error occurs because the function pointer was garbage collected?
Why does pinning the pointer as below reduce the number of crashes?
typedef void (__cdecl *ProcMessageFunc)(void* param, void* paramBuf, ULONG bufSize);
FuncDelegate^ fp = gcnew MessageFuncDelegate(this, &Handler);
pin_ptr<MessageFuncDelegate^> pinnedFunctionPointer = &fp;
ret = Receiver ((ProcMessageFunc)pinnedFunctionPointer);
|
|
|
|
|
Difficult to say from what you have shown. You can pin a handle to a managed object only temporarily, since a pin_ptr can only be created on the stack. Therefore, if you have something like this:
IntPtr YourClass::GetFuncPointer()
{
FuncDelegate^ fp = gcnew MessageFuncDelegate(this, &Handler);
pin_ptr<MessageFuncDelegate^> pinnedFunctionPointer = &fp;
return ((ProcMessageFunc)pinnedFunctionPointer);
}
then you effectively have only pinned fp for the duration of this method call. A correct way to do this depends on your scenario. I'd recommend something along the lines of the following (I didn't compile it, but you get the idea):
public ref class ClientRegistrar abstract sealed {
static FuncDelegate^ s_ManagedReceiverList;
public static void RegisterClient(YourClient^ p_Client)
{
s_ManagedReceiverList +=
gcnew MessageFuncDelegate(p_Client, &YourClient::Handler);
::Receiever((ProcMessageFunc)Marshal::GetFunctionPointerForDelegate(s_ManagedReceiver));
}
public static void UnregisterClient(YourClient^ p_Client)
{
s_ManagedReceiverList -=
gcnew MessageFuncDelegate(p_Client, &YourClient::Handler);
}
}
Usage (C#):
YourClient tClient = new YourClient();
ClientRegistrar.RegisterClient(tClient);
s_ManagedReceiverList and any YourClient instance you register via RegisterClient will be kept alive as long as the current application domain will exist. Implement UnregisterClient if you need more fine grained control. A delegate does not need to be pinned, the CLR takes care of proper handling of that. It just needs to be kept alive.
Cheers,
Paul
modified 17-Jul-12 10:14am.
|
|
|
|
|
Hi, there
Please give me vc++ learn pdf document or web address or explain about make and use resource dialogbox in vc++
thank you so much ![Rose | [Rose]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
See here[^] for DIALOGEX resource statements, and here[^] for programming guides.
|
|
|
|
|
Please Leave A Sample Source code project if possible with description I'm new comer for VC++
Thank you for your reply 
|
|
|
|
|
Sorry but you will have to find your own. If you are using Visual Studio or Visual C++ Express[^] to create your projects you can use the template in the new project wizard to generate a Dialog project and work from there. You can also find lots of samples in the Articles[^] section.
|
|
|
|
|
Hi, Iam using VC++ 2010. While I want to get the MdiParent-Forms Instance, its giving the error, Really I can't identify my mistake...
My Codes from MdiParent
=======================
#include "For_Student_Detials"
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
For_Student_Detials^ MyStudentDet= For_Student_Detials::GetForm(true,this);
MyStudentDet->MdiParent=this;
MyStudentDet->FormBorderStyle=System::Windows::Forms::FormBorderStyle::None;
MyStudentDet->Dock=DockStyle::Fill;
MyStudentDet->Show();
}
My Codes From MdiChild // CFIS_Main is my Mdi-Container
=========================================================
#any Include Reqd?????
public: static For_Student_Details^ For_Student_Details::_instance = nullptr;
public: static For_Student_Details^ For_Student_Details::GetForm(bool^ IsMDIChild, CFIS_Main^ MyInstFrm) {
if (_instance == nullptr)
_instance = gcnew For_Student_Details();
if (_instance->IsDisposed)
_instance = gcnew For_Student_Details();
if (IsMDIChild)
_instance->MdiParent = MyInstFrm;
return _instance;
}
From the above code I can't identify my mistake, Does anybody can point me?
Thanks For Helps 
|
|
|
|