|
i have a MFC dll from a video capturer SDK which i want to use in C#.
it was defined in MFC function with a class named AVEControl.
i have not the source code of the Dll but only the head file as below.
if i use [DllImport] directly, an runtime exception is shown with the message "can not found the entrypoint in *.dll".
i guess it was because all function is in the class so i can not call it directly.
so i want to know how to wrapper it with VC++.net or otherwise.
<here is="" the="" head="" file="" of="" dll="">
!!!please notice the DEFINE of CLASS!!!
// AVEControl.h: interface for the AVEControl class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_AVECONTROL_H__4E171B4B_A11B_49F1_B41C_5F4A31B5CF08__INCLUDED_)
#define AFX_AVECONTROL_H__4E171B4B_A11B_49F1_B41C_5F4A31B5CF08__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifdef DEVICECONTROL_EXPORTS
#define DEVICECONTROL_API __declspec(dllexport)
#else
#define DEVICECONTROL_API __declspec(dllimport)
#endif
typedef HRESULT (*AVECALLBACK) (PBYTE pbData, LONG lDataLength);
#define E_DEVICE_NOT_READY 0xB0004001L
class DEVICECONTROL_API AVEControl
{
public:
HRESULT StartRecordWithoutPreview(HWND hWndCap, CString FileName, __int64 pFileLength, UINT pFileMessage, BOOL pShowSetting = TRUE);
HRESULT StartRecordWithPreview(HWND hWndCap, RECT rc, CString FileName, __int64 pFileLength, UINT pFileMessage, BOOL pShowSetting = TRUE);
HRESULT StartPreview(HWND hWndCap, RECT rc);
HRESULT SetVideoClippingWindow(HWND hwnd);
HRESULT SetCallback(AVECALLBACK Callback);
HRESULT GetVideoStatus(PUCHAR pSta);
HRESULT SetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect);
void GetCurrentImage(CString BmpFileFullName);
BOOL IsGraphRunning(void);
HRESULT StopGraph(void);
HRESULT ApplySettings(CString IniFileFullName);
HRESULT SetVideoProcAmp(long Property, long Value);
HRESULT GetVideoProcAmp(long Property, long* Value);
HRESULT GetEvent(long* EventCode, LONG_PTR* Param1, LONG_PTR* Param2, long msTimeout);
HRESULT SetNotifyWindow(OAHWND hwnd, long lMsg, LONG_PTR lInstanceData);
HRESULT InitDeviceControl(void);
AVEControl();
virtual ~AVEControl();
};
#endif // !defined(AFX_AVECONTROL_H__4E171B4B_A11B_49F1_B41C_5F4A31B5CF08__INCLUDED_)
|
|
|
|
|
Use PInvoke instead.
If it were a class it would have utilized the ATL helper methods and an entry point would have been found.
Nick
-- modified at 9:15 Tuesday 25th July, 2006
|
|
|
|
|
hi,
i need help regarding on this matter.
i'm facing this error and do not know how to fix it.
fyi, im a beginner in .net.
i'm using datatable as a datasource of my datagrid.
the SQL used to get the data from the database begin with:
SELECT SubName, COUNT(*) AS Total FROM tblOneOnOne WHERE creator='"+User.Identity.Name+"'GROUP BY SubWWID, SubName ORDER BY total DESC
my error is as follows:
----------------------------------------------------
Server Error in '/nco6Peoplemap_dev' Application.
DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name ID.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name ID.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name ID.]
System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +147
System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) +1317
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +49
System.Web.UI.WebControls.BaseDataList.DataBind() +23
NCO6Peoplemap.OneOnOne_report.BindSubordinateName() in c:\nco6peoplemap\oneonone_report.aspx.cs:142
NCO6Peoplemap.OneOnOne_report.CheckAccess(String sIDSID) in c:\nco6peoplemap\oneonone_report.aspx.cs:76
NCO6Peoplemap.OneOnOne_report.Page_Load(Object sender, EventArgs e) in c:\nco6peoplemap\oneonone_report.aspx.cs:53
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +772
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300 -----------------------------------------------------------------------------
really hope that someone can help me on this.
Thanks so much!
|
|
|
|
|
nurul aida wrote: DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name ID.]
First instance of error
nurul aida wrote: DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the name ID.
Second time it appears
nurul aida wrote: 'System.Data.DataRowView' does not contain a property with the name ID.
Third time it appears
If you need any more explanation try checking your column names to make sure that they match up.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
i did check and all my column name, it did match up.
any clue?
|
|
|
|
|
nurul aida wrote: any clue?
Nope
The exception quite clearly states that it can't find the ID column in the DataRowView so that's where you'll have to look.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Ed, thanks for the help.
it is actually one column didn't match...
thanks!
|
|
|
|
|
Hi,
I'm wrinting a windows application in C# and want to build a 'breadcrumbs' section to show the user where they are in the application.
In keeping with the webstyle of breadcrumbs most users are familiar with I want my breadcrumbs to display as hyperlinks.
I tried using a group of linklabels (on for each level) but I have trouble with this when one of the level names is so long that it overwrites part or all of the next label... so I thought I'd use a richtextbox.
I declared a couple of strings to handle the rtf syntax:
<br />
string rtfStart = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Verdana;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs18 ";<br />
string rtfEnd = "/\\par\r\n}\r\n";
then added my level names inbetween:
<br />
string test = rtfStart + root + Separator + deck + rtfEnd;<br />
richTextBoxBreadCrumbs.Rtf = test;<br />
However this just displays my level names without URL style formatting.
So my question is, can you force a richtextbox to display a string which is not a URL as a URL and if so, what am I doing wrong?
If this can't be done and I have to resort to using a linklabel, is there any way to deduce which part of a link label has been clicked if I just build my breadcrumbs as one long linklabel?
Too hot and tired, Newbury, UK
|
|
|
|
|
Hi!
You might want to take a look at this article[^]
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Mav,
I think that's just what I'm looking for. Thanks!
Mike
|
|
|
|
|
hi
can you please tell me if there's a way to check the current InputLanguage if it's considered a latin language?
thank you
|
|
|
|
|
use System.Globalization; namesapce<br />
and check <br />
<br />
if(CultureInfo.CurrentCulture.DisplayName=="Latin")
<br />
to get currently istalled cultures name use CultureInfo.InstalledUICulture.DisplayName
-- modified at 2:18 Tuesday 25th July, 2006
|
|
|
|
|
I do not think there is a direct way. You can go though the CultureInfo's TextInfo property and get the code page (ANSI, OEM or whatever you like) and try to base it on this. It would probably narrow it down to a few codepages you should "include", but to be honest I am afraid you might as well create a manual list and check the major language name. It should not take toooo long.
|
|
|
|
|
I'm literally trying to clone data rows, nothing very complicated, infact, they aren't even going to be changed during this section of the project.
I've captured the rows I want to clone using a custom SQL query, but I'm not sure how to insert them back into the database with new ID's(primary key is autonumber)...
can't I just run a .update of some sort?
I've tried copying the data table from results of my query and merging into the complete table, that doesn't make any change.
I dont seem to be able to .insert anything other then independant values for each column.
I'm using VS 2005 and C#.
Thanks.
|
|
|
|
|
I want to add an attribute
[TypeChecker()]
public class MyClass {}
That will format all serializable properties to a date format of "yyyy/mm/dd"
Is that possible with an attribute?
I know it can be accomplished with AOP, but thats bulky and I would like to avoid that.
Thanks,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
But you may have to write your own serializer to acheive it ( idk?) also you would most likely want your attribute on the property level.
One workaround is to mark your date property as not serializable and create a seperate string property that returns the string formated the way you want it.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: One workaround is to mark your date property as not serializable and create a seperate string property that returns the string formated the way you want it.
Well not actually. Since it will be evaluating at class level it should stay there. Plus, it puts a lot of responsibility on the developer to remember to include the attribute on each method.
Ennis Ray Lynch, Jr. wrote: But you may have to write your own serializer to acheive it ( idk?) also you would most likely want your attribute on the property level.
And actually since an attibute is added at runtime I can just have my attibute extend the ISerlializable and iterate through each property. Formatting the date fields as they are encountered.
Thanks for your efforts to help,
Nick
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I was trying to implement .net remoting in my project as
object oriented programming. Means, I get success to create
server process as SAO/CAO but in my client application after geting server remoted object, I was trying to pass a object in method of server remoted object, whitch was created on client side .
But I could'nt succes.
If you need my project to solve my problem , then send me email on EMAIL ID : sanjaykhang@yahoo.co.in
|
|
|
|
|
more than likely its not serializable. But know one can answer with that little amount of information
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
I was trying to implement .net remoting in my project as
object oriented programming. Means, I get success to create
server process as SAO/CAO but in my client application after geting server remoted object, I was trying to pass in method of server remoted object, whitch was created on client side .
But I could'nt succes.
If you need my project to solve my problem , then send me email on EMAIL ID : sanjaykhang@yahoo.co.in
|
|
|
|
|
As short as i can explain... I have a RichTextBox that i want to use for syntax highlighting. For coloring i use:
richControl.Select(...);
richControl.SelectionColor= ...;
and it works . The text is highlighted using a list of keywords. Lets say that I have te following line in my textbox:
I like icecream
In this line "like" is a keyword and its color is red(for explanation sake) and all the other words are black. THE PROBLEM is that if I move the caret just after the word "like" and I start typing, the new inputed characters will also be red,and i wanted them to be black. How can i escape this problem?
|
|
|
|
|
That's the regular behaviour you get in every text editor under windows that allows for formatted text.
If you really want to do syntax highlighting in your RTB yourself (although there are several articles here on this topic), you should reconsider when to perform colorization.
If you do it whenever the text is changed or when a key is pressed, then you'll find out that like + the letter you typed isn't a keyword anymore, so the whole word should be black.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I implimented the Windows Media Player control in my project, it is very easy to pen a file with it but how can i load the file without openning it, is there a property(Load)?
and how can i give it an array of files, with there path?
and how can i see what is the time of the song?
Thanks
|
|
|
|
|
Hi,
I am trying to convert c++ code into c# code, and I am having trouble with arrays in structs.
The c++ struct looks like the following:
typedef struct {
int nAs;
int As[8];
int nBs;
int Bs[12];
int nCs;
int Cs[30];
} AN_ENTRY;
After quite a bit search, I figured out the definition can be changed to this:
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct AnEntry
{
public int nAs;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=8)]
public int[] As;
public int nBs;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=12)]
public int[] Bs;
public int nCs;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=30)]
public int[] Cs;
}
But how would I go around and initialize such a struct, I mean they are 53 integers that need to be passed in to initialize this? Can I do the following?
AnEntry anEntry = new AnEntry(1, 1, 1, 1, ....., 1, 1); // 53 1's
Do I have a define a constructor in the struct? If yes, the argument list of the constructor would be REALLY long. What if I need to create an array of AnEntry? Any suggestion or comment is highly appreciated. Thanks a lot.
|
|
|
|
|
Usually when your passing a new array of something into a constructor / parameter, you would do something like this:
AnEntry anEntry = new AnEntry(new int[53]{1,1,1,1,1,1,1,1...}) ;
make sense?
|
|
|
|