|
Hi all,
I created a managed C++(CLR) dll say D. In it Iam using a native C++ file say C.cpp.
I created C* Cobj in my D.cpp. On building I got some link errors. So I included C.cpp and C.h in D's workspace.
But now I am getting some compilation errors :-
error C3861: 'CreateWaitableTimer': identifier not found
CreateWaitableTimer is used in C.cpp. Also in C.cpp, I did like below :
#define _WIN32_WINNT 0x0500
#include <stdafx.h>
#include <windows.h>
#include <stdio.h>
Still I am getting the above compilation error on CreateWaitableTimer...
Pls help me..
Regards,
Vidhya
|
|
|
|
|
What's in your stdafx.h file?
Member 3331059 wrote: So I included C.cpp and C.h in D's workspace
What do you mean by this?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hai
I am trying to change the color of a word, while typing itself, for that i wrote the code as follows.
private: System::Void keypressevent(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e)
{
array<String^>^ keyword = gcnew array<String^>{"#include","#define","struct"};
int length = keyword->Length;
String ^ strRTF = this->richTextBox1->Rtf;
this->richTextBox1->Clear();
int iCTableStart = strRTF->IndexOf("colortbl;");
if (iCTableStart != -1)
{
int iCTableEnd = strRTF->IndexOf('}', iCTableStart);
strRTF = strRTF->Remove(iCTableStart, iCTableEnd - iCTableStart);
strRTF = strRTF->Insert(iCTableStart,
"colortbl ;\\red255\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;}");
}
else
{
int iRTFLoc = strRTF->IndexOf("\\rtf");
int iInsertLoc = strRTF->IndexOf('{', iRTFLoc);
if (iInsertLoc == -1) iInsertLoc = strRTF->IndexOf('}', iRTFLoc) - 1;
strRTF = strRTF->Insert(iInsertLoc,
"{\\colortbl ;\\red128\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;}");
}
int len = strRTF->Length;
String^ tempst;
String^ result;
String ^key;
int keylen;
int iRTFLoc;
bool found = false;
bool starcomment = true;
int nlen = strRTF->Length;
for(int nchRTF = 0;nchRTF < nlen;nchRTF++)
{
if(strRTF[nchRTF] == ' ')
{
for(int nkeyword = 0;nkeyword<length;nkeyword++)
{
key = keyword[nkeyword];
keylen = key->Length;
iRTFLoc = tempst->IndexOf(keyword[nkeyword]);
if(tempst == key)
{
found = true;
break;
}
}
if(found)
{
if(starcomment)
{
int location = 4+iRTFLoc+keylen+1;
tempst = tempst->Insert( iRTFLoc,"\\cf3 ");
tempst = tempst->Insert( location,"\\cf0 ");
}
found = false;
}
tempst = String::Concat(tempst, strRTF[nchRTF]);
result = String::Concat(result,tempst);
tempst = String::Empty;
}
else
{
tempst = String::Concat(tempst,strRTF[nchRTF] );
}
}
result = String::Concat(result,tempst);
tempst = String::Empty;
this->richTextBox1->Rtf = result;
}
Now my problem is when i am typing the code in the richtextbox it will be displayed like "diov" instead of "void". I
i think its cursor position problem. can you tell me how to recover this.
|
|
|
|
|
What does the cursor have to do with any of this code?
I'm curious if you know what any of this code does or if you're just
using snippets of code obtained from others without knowing how it works...
If you post code in a readable format (use the PRE tags!) you may
get more and/or better responses here.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'm trying to dynamically load a mixed managed and unmanged assembly developed using VS2005 C++.Net. The code is as followed.
Assembly assembly = Assembly.LoadFile(@"c:\temp\classlibrary1.dll");
The dll was compiled on a machine with VS2005 installed and then copied over to another machine with VS2008 installed only. When I tried to step through the code, I encountered an error on the above line. Following is the exception thrown.
{"Could not load file or assembly 'ClassLibrary1, Version=1.0.2992.40807, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)":"ClassLibrary1, Version=1.0.2992.40807, Culture=neutral, PublicKeyToken=null"}
May I know whether a mixed managed and unmanaged dll developed using VS2005 has compatibility problem when copied over to machine with VS2008 installed only? I noticed a pure managed dll compiled using VS2005 C# will not have the same problem. I've tried installing the Visual C++ 2005 redistributable and the problem persists.
chew
|
|
|
|
|
this code read a some data from file and send to all computer by repeat ring synchronized.
but this code dont work .becuase this code make Thread very much .
i think existed a way for this work but i don't know.
<br />
do<br />
{<br />
Packet=gcnew TcpPacket;<br />
Len=file->Read(Packet->data,0,4096);<br />
Packet->Length=Len;<br />
for (int ClientNumber=0;ClientNumber<SocketsCount;ClientNumber++)<br />
{<br />
Thread ^ThreadUdp =gcnew Thread(<br />
gcnew ParameterizedThreadStart(this, <br />
&SendBuffer));<br />
<br />
info->Add(Packet);<br />
info->Add(ClientNumber);<br />
<br />
ThreadUdp->Start(info); <br />
}<br />
}while(Len>0);<br />
<br />
<br />
private:void SendBuffer(Object ^obj)<br />
{<br />
ArrayList ^arr=(ArrayList ^)obj;<br />
TcpPacket ^packet=(TcpPacket ^)arr[0];<br />
int ClientNumber=(int ^)arr[1];<br />
SendPacket(packet,ClientNumber);<br />
}<br />
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
hi,
i have a code in win32 platform in Vc8 using gmtime to convert localtime to UTC time. but when i was converting the VC8 code to Win Mobile, i wasnt able to do with gmtime. please help out of this situation.
thanks,
Mohanraj
RAJA
|
|
|
|
|
What in the effing world does your question have to do with C++/CLI?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hai,
Hai
I am creating a text editor. My problem is when i was selecting a word, the cursor should point the end of the selected word. I can able to select a word but i don,t know how to place the cursor at the end of the word position.
I am using MC++ (windows form application).
Can you tell me how to do this.
Thanks.
|
|
|
|
|
rose196 wrote: I am creating a text editor. My problem is when i was selecting a word, the cursor should point the end of the selected word.
The mouse cursor? Or do you mean the Caret?[^]
led mike
|
|
|
|
|
Hai
Thanks for your replay.
I mean the caret. I saw the link as you mensioned above i couldn,t understand.
Now i am using richtextbox. can you tell me how to get the caret current position.
Thanks in advance,
|
|
|
|
|
The caret indicates the insertion point. When you have a selection, the
selection is the insertion point so the caret applies to the whole selection.
It does't make sense to show a caret at the end.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
How I can transfer parameters from text box on my form to Command Line and then run this command??
|
|
|
|
|
Hi,
you can start a process with the Process class.
Have a look at the StartInfo property and the Start() method.
|
|
|
|
|
Yes, but I want run Command Line and insert there "command" that should be run by Command Line. The Start() method does not contain many properties that allow process with parameters!! StartInfo property consist of two: "set" and "get" and how I can use it??
Thanks for help!!!
|
|
|
|
|
Xeqtr wrote: StartInfo property consist of two: "set" and "get" and how I can use it??
Read the documentation, pay attention to the type, ...
|
|
|
|
|
|
You're welcome.
|
|
|
|
|
Hi all,
I am planning to develop a website which have a simulator where allows users to design thier nail design online. This will be something drag and drop the design to the fingernail in 3D mode.
I would like to ask can this implement in C# with Managed DirectX? And, how do I implement this using C# wi9th Managed DirectX?
Thanks.
|
|
|
|
|
katelva wrote: I would like to ask can this implement in C#
You can start by asking on the C# board[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks to your reply.
Regards,
Katelva
|
|
|
|
|
Wow - you really spammed the whole site....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi, I have a problem in getting name or other information about USB Memory Sticks among Hard Drives and removable devices by WMI function "Win32_DiskDrive".
There is a code where I tried to get USB Device.
<br />
public: String ^ LogicalDriveInfo(Management::ManagementObject ^ mo, bool shared)<br />
{<br />
String ^ Name1;<br />
String ^ txt = mo["InterfaceType"]->ToString();<br />
do<br />
{<br />
Name1 = Convert::ToString(txt[0]); <br />
}while (txt == "USB");<br />
<br />
return Name1;<br />
}<br />
private: System::Void btnShellApp_Click(System::Object^ sender, System::EventArgs^ e) <br />
{ <br />
Management::ManagementObjectSearcher ^ que = gcnew Management::ManagementObjectSearcher(gcnew Management::SelectQuery("SELECT * FROM Win32_DiskDrive" )) ;
<br />
for each (Management::ManagementObject ^ obj in que->Get())<br />
{<br />
lblSN->Text = LogicalDriveInfo(obj,true); <br />
<br />
}<br />
}<br />
But there are no results to detect only UBS device.
|
|
|
|
|
Dear Sir,
How can I build my proper help in my program .
I am using Visual c++ Net 2005.
|
|
|
|
|
You can either write code to launch help as you see fit, or just have a help file you launch from your app. Depends what you want to achieve.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|