|
Michael Dunn wrote: Are you using VC 2005?
I assume he does. Because his path is pointing to "...\Visual Studio 2005\Projects\...". Although you don't need VS 2005 to create a path like this . From my point of view it looks like he is trying to compile C++/CLI code within a WIN32 project.
regards Tobias
|
|
|
|
|
hello Michael
Yes I am using VC 2005, I think the problem is in the project diffintion becouse when I am using Sample of msdn with there's project files It's work fine.
|
|
|
|
|
I've been trying to work with the wininet API to get the IE user agent string for use as part of a larger program I am working on. First I tried this in VB.NET but got no working results. Now I'm trying to code it in C++ as per the example on the MSDN article I found. The code I have so far is:
<code>
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <windows.h>
#include <winioctl.h>
#include <wininet.h>
int main (int argc, char * argv [])
{
DWORD dwSize;
DWORD errorCode;
bool res;
// This call determines the required buffer size.
res = InternetQueryOption(NULL,INTERNET_OPTION_USER_AGENT,NULL,&dwSize);
if (res) {
// Allocate the necessary memory.
char* lpszData = new char[dwSize];
// Call InternetQueryOption again with the provided buffer.
InternetQueryOption( NULL, INTERNET_OPTION_USER_AGENT,lpszData,&dwSize );
// Insert code here to use the user agent string data.
printf(lpszData);
// Free the allocated memory.
delete [] lpszData;
} else {
errorCode = GetLastError();
printf((char*)errorCode);
}
printf("\nDONE!");
return 0;
}
</code>
Each time it runs I get error code as a very large number (3131961397). Not sure what is going on but am hopeing somebody has the answer out there. The MSDN artitcle can be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/setting_and_retrieving_internet_options.asp
|
|
|
|
|
|
Okay I did and I'm still getting an error. Error number comes back as -1163005939.
|
|
|
|
|
I really need help on this....
This may sound odd, but I need teh code to shutdown the windows workstation. I'm programming in C++. Heres What I have so far:
#include <iostream>
using namespace std;
int main (int argc, char *argv[])
{
cout << "H3ll0 4p0c4lyps3" << endl;
cout << "VIRUS.:.J3$U$I$C0MING" << endl;
cout << "ATTN: I know have complete control of your computer. Destruction is imminent." << endl;
cout << "R3sist4nce is Futil3." << endl;
cout << "WINDOWS ERROR!!" << endl;
cout << "CPU Usage @ 95%" << endl;
cout << "CPU Usage @ 96%" << endl;
cout << "CPU Usage @ 97%" << endl;
cout << "CPU Usage @ 98%" << endl;
cout << "CPU Usage @ 99%" << endl;
cout << "CPU Usage @ 100%. System Overheat. Windows shutdown initiating." << endl;
cout << "Please press ENTER to Continue" << endl
;cin.get();
return 1;
}
:Please help me. It's not a real virus, It's a special thing I'm doing at school on programming to get an A. email me the entire completed script to djdomino101@gmail.com. I need this ASAP.
Thanx guyz
-DJ Domino-
|
|
|
|
|
Hello,
Are you planning to play a prank on somebody? Well, you might be successful with this batch file i wrote. But i won't give you a solution in c++
@echo off
echo H3ll0 4p0c4lyps3
echo VIRUS.:.J3$U$I$C0MING
echo ATTN: I know have complete control of your computer. Destruction is imminent.
echo R3sist4nce is Futil3.
echo WINDOWS ERROR!!
echo CPU Usage @ 95%
echo CPU Usage @ 96%
echo CPU Usage @ 97%
echo CPU Usage @ 98%
echo CPU Usage @ 99%
echo CPU Usage @ 100%. System Overheat. Windows shutdown initiating.
PAUSE
shutdown -r -t 0
However, as a programmer you should make everyones life more pleasant, not harder!
regards Tobias
|
|
|
|
|
not sure if u have found the solution but here is the code i use with C.
#include <windows.h>
#include <shellapi.h>
main(){
ShellExecute(NULL, "open", "-s -f -t 23", "", SW_SHOW);
}
- Droz -
___ ___
/\/\ /\ | |
|
|
|
|
|
I've got an ATL project I need to get into managed land. Flip on the /clr switch, remove the /MT switch, and it compiles fine. However, the post-compile step is to register the dll using regsvr32. If I run regsvr32 on my project output, I get the following error:
Screenshot of error message[^]
How do I get around this?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: How 'bout a little guitar now?
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I don't think you can create an ATL COM application with Manage Code.
|
|
|
|
|
Hello all,
I've created a Windows Service project.
But I'm not able to debug the code written in the Start() method.
As mentioned in the Microsoft web site,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskdebuggingserviceapplications.asp
I created a dummy Windows Service, even then I'm not able to proceed furthur.
Please help me in resolving this issue.
Thanks in Advance.
Regards
Sunil
|
|
|
|
|
Hi,
I'm new to Visual C++.Net and I'm trying to write a client-server application in which I want to transfer an image file [JPEG/BMP/GIF] from server to client. Right now, I've written a code which just transfers "String" type of data from client to server and vice versa.
How should I move ahead with images?
Thanks,
Kranti
|
|
|
|
|
Hi,
I would like to ask for soome general advice:
I am developiing a simple application that writes a string directly to the form in a .NET 2003 form application.
I HAVE to use std::string within the paint event so that I can make use of the standard template library.
I would like to step through each character in the string and copy them to a vector if possible.
I would like them within something like a vector so that I can easily access each element, which I cannot efficiently do with the string.
Here is a small bit of example code:
<br />
std::string text_string = "The text to use";<br />
<br />
for_each(text_string.begin(), text_string.end(), someFunction);<br />
I have tried writing a function
<br />
void someFunction(string &atempstring)<br />
{<br />
}<br />
But I get the compiler error
error C2064: term does not evaluate to a function taking 1 arguments
I do not know what this error means, can anybody help?
|
|
|
|
|
richiebaby wrote: void someFunction(string &atempstring)
The only problem I see is that someFunction should not take a string reference, but rather a reference to a single character.
void someFunction(string::value_type ¶meter)
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
richiebaby wrote: I would like them within something like a vector so that I can easily access each element, which I cannot efficiently do with the string.
A basic_string is an STL collection, you can step through it with iterators.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
std::string text_string = "The text to use";
//Is it possible to do this in C++ .NET 2003?
for_each(text_string.begin(), text_string.end(), someFunction);
Yes.
#include <iostream>
#include <algorithm>
#include <string>
using namespace System;
using std::cout;
using std::endl;
using std::string;
using std::for_each;
void PrintChar(const char & ch)
{
cout << ch << std::endl;
}
void Foo()
{
string greeting = "Hello!";
for_each(greeting.begin(), greeting.end(), PrintChar);
}
|
|
|
|
|
This post belongs in the Visual C++ forum.
// The user enters the string
char romanNumerals[32];
cin >> romanNumerals;
// Get the length of the string
size_t length = strlen(romanNumerals);
// Now translate the string
int value = 0;
for (size_t i = 0; i < length; i++)
{
// romanNumerals[i] will have a Roman Numeral
// Remember Roman Numeral Syntax!
}
-- modified at 17:35 Friday 7th April, 2006
|
|
|
|
|
What happens when you type in: MCMXLIV
|
|
|
|
|
wut is tat ?
nvm...whatever i also solved my problem,thk u guy all !!
|
|
|
|
|
Hello,
I have a special question on the Invoke Method of the MethodInfo class and maybe it will show to be a general question on assembly techniques. I am using Managed C++ bytheway.
My goal is to load a library dynamically (as a plugin) and just get a specific function. This is all working well as long as I keep it simple.
- I defined an interface class and all plugin classes derive from that one.
- Now, the function that I want to invoke needs 4 parameters of which 3 are standard .NET objects. The fourth however is my own type.
- If I invoke that function with the parameter array, I get an exception as soon as my type object is not NULL saying the typical "Object cannot be converted to target type".
At first, I had my data class definitions in the main applications and additionally made a library with the same classes, which was linked by the plugin, as the plugin needs the same data classes, of course. I figured, he might have trouble realizing that these are really the same types. So I put the classes into a separate library. Now, the main application AND the plugin link the SAME library. But seperately at different times, I guess.
Could this already be the problem? Or where else is the problem?
I also found something about "copylocal" related to similar problems, which should be set to "false". But I have no idea in which area this setting is to be made and if it will really solve the problem.
Further thought: in the common plugin-samples the thisObject for
mi->Invoke (thisObject,...) is created by
thisObject = Activator::CreateInstance (type);
This doesn't work for me either, as the class information I have is only the Interface which cannot be instanziated. The specific class definition is in the plugin. Is that related to my problem? If the invoke works anyway, I'm fine as it is.
Again: Invoking methods of the same plugin, that do not use my own classes cause no problems.
I would appreciate any help and hint. Maybe I am close or I am far off. I just don't know. My samples were all C# and too simple, so finally, I am lost.
Thank you very much in advance! If you need some code, I can provide that on Monday, when I'm back on my PC.
Thank you and have a nice weekend,
dawei
|
|
|
|
|
Does the directory containing the plugin assembly also contain the assembly in which your type is defined? Does it work if the main assembly, the plugin assembly and the library are in the same directory?
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
In fact, although I set the reference to the same dll within the project settings, a copy of the linked library is created in the plugin folder, which is different from the main applications folder. But the versioning of the libraries should be recognized as the same, shouldn't it?
(stupid question: 'assembly' stands for DLLs and EXEs in .NET, right?)
I will try putting everything into one folder, and I will tell you if it worked or not. The target of my project however was to keep the plugins in an extra folder. Would there be a way to achieve this?
You see I'm coming from the pure C++ originally and I did not yet fully absorbe the assembly management details, although I see it has many benefits.
Thank you and thanks again,
dawei
|
|
|
|
|
dawei.code wrote: But the versioning of the libraries should be recognized as the same, shouldn't it?
Yes, unless you don't build the main application and the plugin project together. A "Build Solution" command (assuming both of them are in the same solution) should take of this problem, if it is the reason.
dawei.code wrote: I will try putting everything into one folder, and I will tell you if it worked or not. The target of my project however was to keep the plugins in an extra folder. Would there be a way to achieve this?
Yes, there are plenty of articles in the internet, just Google for "C# Plugins", you can easily translate the idea to C++/CLI.
dawei.code wrote: 'assembly' stands for DLLs and EXEs in .NET, right?
Yes, but assemblies need not be .dll or .exes. .NET supports multifile assemblies (although VS .NET doesn't), which means you could have code and resources for a single assembly spread across modules.
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
Hi again,
keeping the DLLs together made it (of course I might say). So thank you very much. Fort the moment I can continue. Let's see what else will happen in that course. I also tried the copylocal=false advice, but this brought more problems than I want to take now.
Thank you again and best regards,
dawei
|
|
|
|
|
i've created one DLL (testlib) and i want to use it in my application as an array of its instances ...
i'm getting an exception as
'System.NullReferenceException'
plz consider the following code ..
//-------------------------------------------------------------------------
testlib::testlibControl *tmp1 __gc[];
for(int i = 0; i < strength; i++)
{
tmp1[i] = new testlib::testlibControl;
tmp1[i]->Location = System::Drawing::Point(x,y); //exception
tmp1[i]->Size = System::Drawing::Size(24, 29);
x += 30;
this->Controls->Add(tmp1[i]);
}
//-------------------------------------------------------------------------
Why does this code cause exception?
Thanks,
Kranti
|
|
|
|