|
Why are you using a DLLImport and an external function declaration? Why not just add a reference in Visual Studio in your IWFHotkeyStarter by right-clicking the References folder and clicking Add Reference, then browsing for the DLL.
Better yet add both projects to the same solution and use a Project Reference.
Forgive me if you're doing this for a specific reason, but I'm guessing it doesn't work because C# DLLs are not machine code. I've only ever seen DLLImport and extern used for native DLLs, whereas .NET DLLs are in IL, not native code.
Then you will have something like:
using Kosmala.Michal.ActiveXTest;
namespace IWFHotkeyStarter
{
class Program
{
static void Main(string[] args)
{
Program p = new Program();
p.run();
}
private void run(){
Console.WriteLine("run<<");
ActiveXTest.setHooks();
Console.WriteLine("run>>");
}
}
}
|
|
|
|
|
you seem confused. A DLL is one of these two:
1.
a bunch of managed code, invisible to DUMPBIN, no need for DllImport; just add reference, use a using statement, and use its public types as if they are part of your EXE itself. the DLL will be copied into your EXE's folder.
2.
a bunch of native code (hence not C#), visible to DUMPBIN; needs DllImport and C# prototypes; add reference is impossible, P/Invoke is required; the DLL gets located through the Windows PATH environment variable.
|
|
|
|
|
Hello, I've created a web performance test that logs me in to an internal site. I want to be able to hide the password in the code so I can check it into VSS. I see that creating CodedUI tests seem to encrypt the passwords (i.e. you see what looks to be a hash string instead).
Is there a way to more easily do that with web performance tests?
Thanks in advance for any assistancee.
------
jboyd
|
|
|
|
|
Hi guys. I am looking for a simple FTP connection. I have an FTP Server running on my local machine. How do I connect to this FTP server using code? All the samples I find refer to a WEB FTP connection. Can somebody direct me to a simple ftp connection that connects to either a local FTP server or connection to an FTP server on a network?
Thanks guys.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
I expect FtpWebRequest to work similar to HttpWebRequest, so use the IP address and go ahead. Whether your server is local or on the Internet seems irrelevant to me.
|
|
|
|
|
Hi,
You can use below API's...
Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Private Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUserName As String, ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Long
Private Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
Private Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean
Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hConnect As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, ByRef dwContext As Long) As Boolean
Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
Regards,
SunilG.
|
|
|
|
|
Thanks for that, however:
1. I'm not the one asking for an FTP solution; you replied to the wrong message.
2. This is the C# forum, no need for VB code.
3. And why would we use P/Invoke when .NET itself has what is required.
|
|
|
|
|
Apart from that, what have the Romans ever done for us?
|
|
|
|
|
Pete O'Hanlon wrote: what have the Romans ever done for us?
Lots of good things came from the Romans.
They gave us nice roads, connecting major cities, sometimes in remarkably straight lines; admittedly, they haven't been upgraded soon enough (the roads I mean), so now we sometimes have a bit of a jam.
And then they gave you the Hadrian Wall, to protect you against neighboring savages. How can you forget all that?
|
|
|
|
|
Not a Monty Python fan then I take it. Clickety[^]
|
|
|
|
|
Under other circumstances, yes, I am, very much so. I do appreciate the classics.
Questions in programming forums are always taken seriously though.
Well, maybe not really always...
|
|
|
|
|
Forgot to mention, I also appreciate Cleese's more serious stuff: his business training movies, seminars, etc. Enjoyed a couple of interviews he gave. Quite a guy.
|
|
|
|
|
My dear friend,
I havent told you to copy and paste all the APIs in C#.
You can you these APIs in C# only the syntax is different.
Regards,
|
|
|
|
|
I have used this sample Multi-Y Demo from the ZG Wiki site to build a graph that has 4 Y Axis points and the X axis is time based.
The first time through all the y axis stuff works as expected. The 4 items are of dissimilar values and the ranges in the y legends range correctly.
For example
y1 legend has a range of 15 - 35
y2 legend has a range of 85 - 90
y3 legend has a range of 6 - 16
y4 legend has a range of 4 - 24
The from then on only the first 2 y axis legends range correctly but 3 and 4 seem to use the existing y1 and y2 values.
For example
y1 legend has a range of 15 - 35
y2 legend has a range of 85 - 90
y3 legend has a range of 15 - 35
y4 legend has a range of 85 - 90
So I have been unsucessful in trying to clear all y legends.
I have tried...
zg1.GraphPane.CurveList.Clear();
Again it works the first time but not the second.
Has anyone ran into this? Is there a way to dispose and then re create the control programatically so that it would run like it was the first time?
Any Help Would Be Appreciated
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
I have some image url, such as http://images.csdn.net/20101130/2.jpg[^]
I want to download it to local disk using the WebClient, but error.
WebClient webClient = new WebClient();
Uri uri = new Uri("http://" + address);
webClient.BaseAddress = "http://" + uri.Authority;
webClient.DownloadFile(uri, fileName);
The local *.jpg display html label. <!--
This file is used for request transmitted from lighttpd or nginx.
-->
|
|
|
|
|
your code worked for me.
suggestions:
1. enter your error message in the Google search box.
2. if that does not help, tell us the exact error, all of it, and point us to the line it mentions, if any.
|
|
|
|
|
Hi,
I want to develop a simple POS machine software for a supermarket.. It seems that everything is fine but I just want to know how can I open the cash drawer from my C# application regardless of the machine brand and model?
Thanks,
Jassim Rahma
|
|
|
|
|
Again I must tell you to stop flooding forum with question only from your side.
kindly follow my suggestion what I gave you on ASP.NET forum, Please.
|
|
|
|
|
if your subject line is any good, then typing it into either the Google search bar, or the CodeProject search bar, would yield the answer you want. Now start learning to search.
|
|
|
|
|
You can't. Any question of the format "how can I <do some hardware function> from my C# application regardless of the machine brand and model" will have the same answer. In situations like that you code for the most popular hardware configurations. How many hardware types you include depends on the market segmentation of the hardware. In other words if 2 vendors cover 80% of the market, 2 is enough, but if to get 50% market penetration you need to cover 4 vendors, you might want to go 5 or 6. Then if you have built a product that is useful enough someone may pay you to add in other hardware platforms.
|
|
|
|
|
Hi,
I have below problem.
An XSD schema file is converted into a C# class via XSD.exe.
Object of the C# class is stored into an object pool.
When a cunsumer needs a particular type of object, he will scan through the object pool and get the required object.
problem here is when the cunsumer is scanning the object pool, how will he identify the different types of object,
since there will be lot of different type of objects in the pool?
I want to make my objects self explanatory, so that the cunsumer can identify them and consume them.
How do I achieve that?
Thanks in advance
|
|
|
|
|
I don't think you're explaining yourself very well; I'm really unsure about what you're asking.
The code generated by XSD.exe, can you edit this? Can you change the names/re-arrange the namespaces to do this?
You could also look into attributes[^], which are a way of providing information about a class at the class level (rather than at the instance level). From what you're saying, I can only guess at attributes for the moment.
Could you explain further what you're trying to achieve?
|
|
|
|
|
Hi All,
sorry for my bad english.
I need your help for reading a driver name available in the "Device management" of O.S.
Example, I install an USB driver associated with an internal COM PORT assigned from O.S., and I need to find this COM PORT associated at this driver.
I reading all com port of O.S., but what's the right one?
Thanks a lot for any suggestion.
Alex
|
|
|
|
|
I don't know about getting the driver name, however using WMI class Win32_SerialPort one can obtain a lot of information, e.g. there are strings such as Caption, Description, DeviceID, Name. Not all of them are always present, however they should suffice to recognize the port you're looking for.
|
|
|
|
|
Thanks Luc, I try this solution.
Alex
|
|
|
|
|