|
yes it can be done using c++ project wrapper then you would add reference to that dll into .net ,
but be careful , when you do so , you lose the portability that microsoft struggles for when it creates .NET technology , it can't be run on different OS because your embedded assembly code will be targetted for specific platform .
Requirements to create the c++ wrapper dll
1 - Decorate the method in c++ as "extern" to stop the compiler from changing the method name when you compile your DLL .
2 - you can even call the dll methods without using unsafe declaration , because it will be treated like any dll referenced in .NET project.
i hope this helps
Human knowledge belongs to the world.
|
|
|
|
|
Strictly speaking, you can't as others have said.
However this thread[^] says that you can use simple assembler instructions inline. WARNING You have to register to download the code. No personal details are required though.
I also doubt that it compiles down to a binary file, don't know because I haven't looked at it myself yet. Still it might be fun even if not actually useful.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
|
How can I write sql sentence with byte[] parameter?
NOTE: I don't want to use SqlParameter.
string sql = "INSERT INTO MyFile(FileId, BinaryFile) VALUES('" + fileId + "','" + file + "')";
....
command.ExecuteNonQuery();
fieldId is int variable, file is byte[] variable.
In database; FileId is int field, file is varbinary(MAX) field.
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:29am.
|
|
|
|
|
I don't want to use SQL Parameter. I use MS SQL.
|
|
|
|
|
Tough, you have to. And it's the right thing to do, every time.
|
|
|
|
|
First of all, please don't use sql like this. As you are using SQL Server, you should really use command parameters (this helps circumvent SQL Injection Attacks). Then you could set the data easily, as detailed here:
using (SqlCommand cmd = new SqlCommand("MyFile(FileId, BinaryFile) VALUES(@fileid, @file", connection)
{
cmd.Parameters.AddWithValue("@fileid", fileid);
cmd.Parameters.AddWithValue("@file", file) ;
cmd.ExecuteNonQuery();
}
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
That's like saying you want to swim but you don't want to get wet. Maybe if you tell us your reasons why you don't want to use a parameter object we could help you with a solution that better fits your needs. Otherwise it isn't worth coming up with an answer because who knows what other objects you refuse to use for no apparant reason.
|
|
|
|
|
Like other have said, unless you're really experienced with SQL, you should use parameters (and even if you are really experienced, it's still a good idea).
The first problem is you appear to be using the wrong data type to store bytes. VARBINARY is a character type to store binary strings (useful for forcing case sensitivity, IE, 'a'='A' in a char type, but not a binary type) - http://dev.mysql.com/doc/refman/5.1/en/binary-varbinary.html[^] You probably wanted a BLOB type of some kind.
As for storing byte[] with an SQL statement, converting the bytes into a hexadecimal string value should work -
INSERT INTO (FileID, Data) VALUES (1, 0x0F2EAA32);
|
|
|
|
|
|
How i can disable Intrupt in Critical Section?
please guid me
|
|
|
|
|
Even if you manage to do that (which you won't, you'd need to execute cli in ring 0, how to do plan to do that?) you would completely break windows. Not good.
Why do you think you need to do this?
|
|
|
|
|
harold aptroot wrote: Why do you think you need to do this?
To dream the impossible dream
To fight the unbeatable foe
To bear with unbearable sorrow
To run where the brave dare not go
To right the unrightable wrong
To love pure and chaste from afar
To try when your arms are too weary
To reach the unreachable star
This is my quest
To follow that star
No matter how hopeless
No matter how far
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
is that really you, Pete O'?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
'tis I. It seemed appropriate (and I just heard it on a Honda ad).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
you'd better explain why you want to do this, and what it is you want to achieve. There may be better ways.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
The correct answer is {EA2E30B3-5AC2-400e-91D7-72E353F0760D}. He asked you to guid him.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Now I have a guiding problem, your codes throw a BadArgumentException.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
My client application and server application runs on two different machines (client app is a WinForm and server app a WCF service). In the client app, the user needs to point out a location on the server [e.g. D:\SomeFolder or C:\SomeFolder\SomeOtherFolder]. These are not shared folders.
The best way would be if I could show a FolderBrowserDialog on the client displaying the server's Desktop, local drives, mapped drives etc. just like it would display those items from the local machine.
I've been stuck with this for a couple of days now, unable to find a good solution, so I thought I'd check if anyone here knows how this could be achieved. In a desperate attempt I even tried to let the service return a FolderBrowserDialog (created on the server) and then called the .ShowDialog() method on the client side - but that only showed the local Desktop, drives, folders etc..
Does anyone have any good pointers? I could of course have the server return its drives and when the user selects a drive show the folders and then when the user picks a folder show that folder's subfolders and so on, but before I do I want to check if there is an easier way (why reinvent the wheel, right?).
|
|
|
|
|
I'm just gonna write my own. It won't take too long
|
|
|
|
|
Pls i have a win app, i wan to make it start running as windows starts.
how do i do it.
thanks
|
|
|
|
|
put a shortcut in the current users "..\Start Menu\Programs\Startup" folder.
|
|
|
|
|
You can make your program to be launched automatically by Windows at start-up using registry. See here[^] for additional information.
Another option is adding your application to: Start->[All] Programs->Startup sub menu (C:\Documents and Settings\All Users\Start Menu\Programs\Startup).
|
|
|
|
|
Make it a Windows Service (though it would then have no UI).
Run it as a Windows Scheduled Task.
|
|
|
|