|
This is the managed C++ forum, is that what you wanted ?
I don't believe there is a mouse.h, what's your source of reference ? What sort of program are you writing ( windows forms, MFC, Win32, console, etc )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Mouse, keyboard, monitor, serial port, etc have become the standard, generic I/O interface built in Windows. There are a number of abstractions above these hardware devices. You don't deal with them directly any more.
If you have specific questions about how to handle mouse clicks, post them on "Visual C++/MFC" forum.
-- modified at 11:52 Tuesday 19th September, 2006
Best,
Jun
|
|
|
|
|
Is it normal for managed c++ classes to be coded with all their members inlined in one file like c# or do you still split the interface and implementation between a .h and .cpp file?
The examples in MSDN that I've seen seem to have everything in lined and coded in one file
|
|
|
|
|
Josh Gray wrote: do you still split the interface and implementation between a .h and .cpp file?
I don't split with VS.NET any more.
Josh Gray wrote: The examples in MSDN that I've seen seem to have everything in lined and coded in one file
One important reason could be that when you use VS.NET IDE, all the compiler generated code is defaulted to the header, including event handlers. Manually relocating the compiler generated code could cause problems to code updates later. That said, I am not aware of any C++/CLI coding standard that supports or objects to this trend.
Best,
Jun
|
|
|
|
|
In managed C++, writing all of a class' members inline is okay especially if it was created by a wizard. However, if you need to reference a class created later in your source code, you will be forced to use the standard way of writing C++ classes.
|
|
|
|
|
I still split my classes into .cxx and .h files (I use .cxx to distinguish C++/CLI from traditional C++).
I prefer having header files which only contain declarations and no implementations, because these can be #included in other header files (in the same project) with minimal cost (together with typedefs of instantiated generic/template types). So when I want to use one class in another class, I can just #include the other class' declaration (I don't want to include the function implementations, just the declarations). Also if I change any part of the implementation, I don't need to recompile several classes. In C# you can use .net classes from the same project in other compilation units without #including any class definition, but not in C++/CLI. If C++/CLI supported metadata importing from other object files in the same project, quite a few of my reasons would disappear, and I would (mostly) only have .cxx files.
|
|
|
|
|
I need some kind of thing that I can run while I'm away from my computer that will automatically refresh the active webpage once every hour. Is this possible and if so, some of your expertise would be greatly appreciated!
I dont really even know if this is the right area to post in, so if its not please let me know where would be a better place for this type of request.
Thanks!
|
|
|
|
|
trixter2004 wrote: I need some kind of thing that I can run while I'm away from my computer that will automatically refresh the active webpage once every hour.
Avant Browser (which is wraps IE) has this as an option, any one of the tabs can be set to refresh at specified intervals.
http://www.Avant.com[^]
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
ok ive got the avant browser now....can anyone help me out on how to make it auto refresh?? ive looked through the options and stuff and cant seem to find anything...maybe ive overlooked? any help would be greatly appreciated. Thanks!
|
|
|
|
|
trixter2004 wrote: can anyone help me out on how to make it auto refresh?? ive looked through the options and stuff and cant seem to find anything
Navigate to the web page.
Right click on the tab,
Scroll Up to Auto Refresh.
Select value
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
thanks so much! works perfectly...really appreciate your help
|
|
|
|
|
trixter2004 wrote: thanks so much! works perfectly...really appreciate your help
You welcome. :->
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Hi All,
I'm writing a program, part of which needs to read text from a .log file in UNICODE line by line, then convert it to ASCII and write it to an ASCII .log file line by line...
I've been battling with this issue for a week, and have yet to find a solution.
PS: I'm writing in C
Thanks a lot
Alex
|
|
|
|
|
|
i have a small console program that shows you, your ip and resolves from your ip your host name(reverse dns) and display then your ip and host name to the screen.
an example output:
IP: 12.34.567.89<br />
Host Name: dslb-012-034-567-089.pools.myisp-ip.net
now i want to convert the
dslb-012-034-567-089.pools.myisp-ip.net
to
dslb.pools.myisp-ip.net
or something similar.
my goal is to remove the numbers and the "- " character from the host name string, because my ip is a dynamic ip and it changes every 24hrs automatically. it should start to find the first "- " character and from there, until the first ". " character or last number in the host name string and then cut out the found unneeded characters and then display the final host name string without the ip and the "- " character.
i'm using msvc++ as compiler.
how would i do that?
any help and hints are more than welcome.
|
|
|
|
|
I would suggest searching for the index of the first '-' and the first '.' using System::String::IndexOf. Then use each index with System::String::Substring to get the "dslb" and ".pools.myisp-ip.net" sub-strings.
|
|
|
|
|
thanks zaccheus, i could solve it with help from a good online friend, his hint was to use:
#include <stdio.h><br />
<br />
void main()<br />
{<br />
char host[]="dslb-012-034-567-089.pools.myisp-ip.net";<br />
<br />
printf("\n %s ", host);<br />
strcpy(strchr(host,'-'),strchr(host,'.'));<br />
printf("\n %s",host);<br />
<br />
} output:
dslb-012-034-567-089.pools.myisp-ip.net <br />
dslb.pools.myisp-ip.net
and i modified it to:
char* cShortHost = host->h_name;<br />
strcpy(strchr(cShortHost, '-'), strchr(cShortHost, '.'));<br />
<br />
printf("\nShortHost Name: %s", cShortHost);
|
|
|
|
|
I noted with joy that the Array class has GetValue(Int64) and SetValue(Object^, Int64); however there does not seem to be a way to (re)size an array using Int64, which makes me wonder (a) why not and (b) why the Int64 versions of Get/SetValue?
|
|
|
|
|
The array class represents an array. A dynamic array would be the List class in .NET 2.0, or ArrayList in 1.1.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
That REALLY does not answer my question ... at all.
You CAN resize an array; my question is why System::Array provides 64-bit indexing even though the array size is limited to 32-bit?
|
|
|
|
|
You can ? OK, well that seems redundant to me, it obviously needs to create a new array for larger sizes anyhow.
I see what you're asking now, but it looks to me like you've found an error in the class, obviously if you can't size it to 64 bit, then the fact that the index is 64 bit is irrelevant, no two ways about it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You can't resize it with an Int64, but you can create one with an Int64 initially:
long size = (long)uint.MaxValue + 10;
byte[] buffer = new byte[size];
Console.WriteLine(buffer.LongLength);
It will crash because it runs out of memory in a 32bit process, but on the 64bit version of the .NET Framework it should run correctly.
|
|
|
|
|
In C++/CLI:
<br />
Int64 big = Int64(0x7FFFffffFFFF);<br />
<br />
array<String^>^ anArray = gcnew array<String^>(big);<br />
the compiler issues the following warning:
<br />
.\Main.cxx(37) : warning C4244: 'initializing' : conversion from '__int64' to 'int', possible loss of data<br />
for the line containing the gcnew statement.
|
|
|
|
|
Who knows the link to source code of matching string , such as: morris pratt, Brute force...thanks.
|
|
|
|
|
Few days ago I asked a similar question, but it seems I wasn't clear about the problem. I'll try to rephrase question in hope that it will be more clear.
I have a managed code that I would like to call from unmanaged application. This is the sample that explains the problem that I stumbled upon.
Here is a C++ dll that I would like to call:
using namespace System::Windows::Forms;
extern "C" DLL2005_API int fnDll2005(void)
{
// unmanaged Message box
::MessageBoxA(0, "unmanaged text", "unmanaged caption", 0);
// Managed message box
System::Windows::Forms::MessageBox::Show("managed text", "managed caption");
return 42;
}
--------
I am trying to call this DLL from a sample console application written in VC6:
extern "C" __declspec(dllexport) int fnDll2005(void);
int main(int argc, char* argv[])
{
fnDll2005();
return 0;
}
so far so good, everything works fine, console application calls dll and both
dialog boxes are shown, unmanaged and managed one.
Problem arises when C++ function tries to call another managed method written
in C#. Here is the C# code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace ClassLibrary1
{
public class Class1
{
public static int ShowDialog(string sText, string sCaption)
{
System.Windows.Forms.MessageBox.Show(sText, sCaption);
return 0;
}
}
}
nothing special, a simple C# assembly, and here is the modified C++ function
that should call C# method:
using namespace System::Windows::Forms;
using namespace ClassLibrary1;
extern "C" DLL2005_API int fnDll2005(void)
{
::MessageBoxA(0, "unmanaged text", "unmanaged caption", 0);
System::Windows::Forms::MessageBox::Show("managed text", "managed caption");
ClassLibrary1::Class1::ShowDialog("class library text", "class library caption");
return 42;
}
and here's the problem. The moment that console application tries to call fnDll2005 function the program breaks with message "unhandled exception in console1.exe (KERNEL32.DLL)..."
If I compile console program with VS2005 everything works fine. I don't understand why the program breaks when I call C# code when in the first example obviously CLR was started when I called it from C++ code. Since I'm a newbie in managed world I don't know if what I am trying to do is possible at all? Is there a way to call unmanaged function (from a program written in VC6) in a DLL that would later call managed code?
Tnx in advance
Dragan
|
|
|
|