Click here to Skip to main content
15,889,034 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Pin
OriginalGriff31-Jan-15 4:48
mveOriginalGriff31-Jan-15 4:48 
GeneralRe: C# Pin
LLLLGGGG31-Jan-15 5:11
LLLLGGGG31-Jan-15 5:11 
AnswerRe: C# Pin
OriginalGriff31-Jan-15 4:47
mveOriginalGriff31-Jan-15 4:47 
QuestionDrawing semi-transparent polygons in C# for CF Pin
Arturo D. Gentili31-Jan-15 1:25
Arturo D. Gentili31-Jan-15 1:25 
AnswerRe: Drawing semi-transparent polygons in C# for CF Pin
Dave Kreskowiak31-Jan-15 4:24
mveDave Kreskowiak31-Jan-15 4:24 
AnswerRe: Drawing semi-transparent polygons in C# for CF Pin
BillWoodruff31-Jan-15 18:05
professionalBillWoodruff31-Jan-15 18:05 
GeneralRe: Drawing semi-transparent polygons in C# for CF Pin
Arturo D. Gentili2-Feb-15 0:01
Arturo D. Gentili2-Feb-15 0:01 
QuestionHow can use these WinApi function in c# Pin
Ahmet Doğan30-Jan-15 23:54
Ahmet Doğan30-Jan-15 23:54 
How can use these WinApi function in c#
Hello i want use a dll file in C#;
this dll file have made in C++ Language.
I want use two function in this Dll file.

This dll file definition c# file is like here:

Code:
using System;
using System.Runtime.InteropServices;
public static class Lcad
{
public const int LC_FALSE = 0;
public const int LC_TRUE = 1;
public const int LC_LBUTTON = 1;
........
.........
[DllImport("litecad.dll", EntryPoint="lcDrwLoadMem", CharSet = CharSet.Unicode, ExactSpelling = true)]
public static extern bool DrwLoadMem(int hDrw, int hMem, int hLcWnd);

[DllImport("litecad.dll", EntryPoint="lcDrwSaveMem", CharSet = CharSet.Unicode, ExactSpelling = true)]
public static extern int DrwSaveMem(int hDrw,int hMem, int MemSize);
}
I want use lcDrwLoadMem and LcDrwSaveMem in my appliation.

I want give some information from dll help file:
These two function definitons:

int lcDrwSaveMem (
HANDLE hDrw,
HANDLE hMem,
int MemSize
);

Parameters
hDrw
Handle to a drawing object.
hMem
Pointer to a memory buffer. If this value is NULL, then LiteCAD will not write to a memory, but, calculates the drawing's size only.
MemSize
Size of the memory buffer, in bytes. This will be ignored if the hMem argument is NULL.

Return Value

Number of bytes copied to a memory. If the return value is zero - an error occurred during this operation. This can happen if the memory buffer size is too small to contain the drawing.
If hMem parameter is NULL, then the return value is a number of bytes required to contain the drawing.

Remarks

Your application must allocate a memory buffer of sufficient size to store the drawing. To determine the drawing's equivalent buffer size, use this function with the hMem=NULL parameter.


And other function:
--------
Loads a drawing's data from a memory buffer. The data must has LCD format.

BOOL lcDrwLoadMem (
HANDLE hDrw,
HANDLE hMem,
HANDLE hLcWnd
);

Parameters
hDrw
Handle to a drawing object.
hMem
Pointer to a memory buffer containing a drawing in LCD format.
hLcWnd
Handle to a design window. Specify NULL if you do not want to display the drawing.

Return Value

If the function succeeds, the return value is nonzero (TRUE).

And I want give an Example from help file:
Code sample LiteCAD API

Save and load a drawing using memory buffer


Code:
// global memory buffer
BYTE* gpMem = NULL;

// Save a drawing into memory buffer
//-----------------------------------------------
BOOL SaveToMem (HANDLE hLcDrw)
{
int MemSize;

if (gpMem != NULL){
// the buffer is not empty, clear it
delete[] gpMem;
gpMem = NULL;
}
// get size required for memory buffer
MemSize = lcDrwSaveMem( hLcDrw, 0, 0 );
if (MemSize > 0){
// allocate memory buffer
gpMem = new BYTE[MemSize];
// write a drawing database into the memory buffer
lcDrwSaveMem( hLcDrw, (HANDLE)gpMem, MemSize );
return TRUE;
}
return FALSE;
}

// Load a drawing from memory buffer
// If you don't need to display the loaded drawing, then specify 0 for hLcWnd
//-----------------------------------------------
BOOL LoadFromMem (HANDLE hLcDrw, HANDLE hLcWnd, BOOL bClearMem)
{
BOOL bRet = FALSE;
if (gpMem != NULL){
bRet = lcDrwLoadMem( hLcDrw, (HANDLE)gpMem, hLcWnd );
// clear memory buffer (if don't needed any more)
if (bClearMem == TRUE){
delete[] gpMem;
gpMem = NULL;
}
}
return bRet;
}
Can anybody convert this example to c# code.Please help me.
QuestionTessnet2 in C# reads only one word in the sentence Pin
Praveen Chougale30-Jan-15 23:34
Praveen Chougale30-Jan-15 23:34 
AnswerRe: Tessnet2 in C# reads only one word in the sentence Pin
OriginalGriff31-Jan-15 0:39
mveOriginalGriff31-Jan-15 0:39 
Questionhow i can make code in Page.IsPostBack run on event Pin
Member 1048092030-Jan-15 21:49
Member 1048092030-Jan-15 21:49 
AnswerRe: how i can make code in Page.IsPostBack run on event Pin
OriginalGriff31-Jan-15 0:45
mveOriginalGriff31-Jan-15 0:45 
AnswerRe: how i can make code in Page.IsPostBack run on event Pin
Dave Kreskowiak31-Jan-15 4:08
mveDave Kreskowiak31-Jan-15 4:08 
QuestionHow to enable kiosk mode on windows 7 Pin
vahidbakhtiary30-Jan-15 20:00
vahidbakhtiary30-Jan-15 20:00 
AnswerRe: How to enable kiosk mode on windows 7 Pin
Afzaal Ahmad Zeeshan30-Jan-15 21:22
professionalAfzaal Ahmad Zeeshan30-Jan-15 21:22 
GeneralRe: How to enable kiosk mode on windows 7 Pin
vahidbakhtiary31-Jan-15 0:20
vahidbakhtiary31-Jan-15 0:20 
AnswerRe: How to enable kiosk mode on windows 7 Pin
OriginalGriff30-Jan-15 21:35
mveOriginalGriff30-Jan-15 21:35 
QuestionHow can I dynamically name and instantiate List<string> lists? Pin
turbosupramk330-Jan-15 4:56
turbosupramk330-Jan-15 4:56 
AnswerRe: How can I dynamically name and instantiate List<string> lists? Pin
BillWoodruff30-Jan-15 5:05
professionalBillWoodruff30-Jan-15 5:05 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
turbosupramk330-Jan-15 5:11
turbosupramk330-Jan-15 5:11 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
BillWoodruff30-Jan-15 6:12
professionalBillWoodruff30-Jan-15 6:12 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
turbosupramk32-Feb-15 3:48
turbosupramk32-Feb-15 3:48 
AnswerRe: How can I dynamically name and instantiate List<string> lists? Pin
OriginalGriff30-Jan-15 5:36
mveOriginalGriff30-Jan-15 5:36 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
turbosupramk32-Feb-15 3:51
turbosupramk32-Feb-15 3:51 
GeneralRe: How can I dynamically name and instantiate List<string> lists? Pin
OriginalGriff2-Feb-15 5:07
mveOriginalGriff2-Feb-15 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.