|
I would like to use DPAPI - Data Protection Application Programming Interface to write a Pocket PC application. But does .NET CF have DPAPI?
If not (so unlucky), what can I use?
Thx
|
|
|
|
|
The .NET Framework doesn't encapsulate DPAPI at all. You have to P/Invoke the necessary calls yourself. Read How To Create a DPAPI Library[^].
The Data Protection APIs are supported under Windows CE .NET 4.2 (PocketPC 2003). Windows CE 3.0 does not the DPAPI APIs documented and probably doesn't support it.
Even on PocketPC 2003 (which is actually named "Windows Mobile for PocketPC 2003") you may run into problems because not all of the System.Runtime.InteropServices namespace members are supported. Be sure to view the supported platforms while reading through the System.Runtime.InteropServices documentation in the .NET Framework SDK.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I need to print in Windows98 using Star printer - SP200, which is not capable of graphical printing (can't use DrawString()).
I've tried the code in
<www.c-sharpcorner.com code="" 2002="" oct="" printdirect.aspect.asp="">
changed the left margin (the paper width is 3 inches only) and the ip of printer to be the default printer name using <printersettings.printername> (not shared)
the result is the handle lhPrinter=0 and no response from the printer; nothing is written (pcWritten = 0) although the result of OpenPrinter is not 0.
I appreciate your help...
Sirwan
|
|
|
|
|
|
Hi Stefan,
Thanks for the help.
It looks very important article, but unfortunately I don't understand the language.
Is there any solution can be found in English please?
Thanx
Sirwan
|
|
|
|
|
Hi,
I want to print a report. The height of the report is dynamic.
When I print the report, after the end job, printer eject the last page more than I need. LQ300 eject paper as long az A4 size.
for example: I want to print one line, then the printer stop printing. If I need the paper I self cut it & use it.
I use a roll of paper, no A4 or A3.
I am using c#.
what must I do?
Thanks & Best regards
|
|
|
|
|
hiiii every body can any body help me with this problem
i am using a memory profiler to enhance my code
i discover that an object from (OleDBPermission) is creadted and not removed(disposed) even when i close the connection and Call ReleaseObjectPool what can i do else to release this object please help me
|
|
|
|
|
Permission objects are used by the Framework to protect users and machines and may be instantiated to authorize certain operations. Depending on how certain permissions objects are used, they may remain ni memory until the AppDomain is shutdown.
You should read about Code Access Security - an integral part of the .NET Framework - on MSDN. Read Code Access Security[^] in the .NET Framework SDK.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
Hi!Dear,
I just want to register in the website
www.c-sharpcorner.com. but after I filled in my email address and my nickname,it never sent password to my email box.I am my email address is correct.my email address is:libingmomer@163.com,passward is "libing". I dont know where is the problem.Maybe it treat my email address as a invalid one.
Now I prefer my honoured you can register a nickname and a password on this website for me to login.
Thanks!
|
|
|
|
|
What ever that is you are smoking I suggest you stop.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Hi!Colin Angus Mackay,
Maybe you are wrong.What I said is the truth.I had asked one of my friends to help me out of this matter.Maybe I have done something wrong here,but I was never intent to that.
Thanks!
momer
|
|
|
|
|
This is brilliant. It's definately made my day.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi!Christian,
Nice to know you here.I think you must be a warmhearted person.But thanks to my friend,my problem have been worked out yesterday.
The codeproject is the most kindly one in all the website I have ever known.I love this codeproject and I love you!
momer
|
|
|
|
|
1. Why are you posting registration problems to another site here? Why not try to contact the owner of the site your having problems with?
2. Nice of you to post your account name and password for us to use! Like Colin asked... What the hell are you smoking?!
momer wrote:
I dont know where is the problem.
A short between the keyboard and ground, obviously...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How do I setup a dropdownlist for (***Type***) in editmode. Any starters. Any sites.
I would appreciate any help.
<itemtemplate>
This dropdownlist works in browse | ***Type:**** | <asp:dropdownlist autopostback="True" id="ddlCOMMANDTYPE" datasource="<%# BindTBCOMMANDTYPE() %>"
mode.="" selectedindex="<%# GetSelectedIndexCOMMANDTYPE(DataBinder.Eval(Container.DataItem, "CT_REF").ToString())%>" runat="server"
="" datatextfield="CT_DESCRIPTION" datavaluefield="CT_REF"> | Content: | <%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CM_CONTENT"))%> |
<asp:linkbutton id="EditButton" text="Edit" commandname="Edit" runat="server">
<edititemtemplate>
| ***Type:**** | Content: | <asp:textbox id="CM_CONTENTTextBox" text="<%# DataBinder.Eval(Container.DataItem, "CM_CONTENT") %>" runat="server"> |
<asp:linkbutton id="UpdateButton" text="Update" commandname="Update" runat="server">
<asp:linkbutton id="DeleteButton" text="Delete" commandname="Delete" runat="server">
<asp:linkbutton id="CancelButton" text="Cancel" commandname="Cancel" runat="server">
<asp:linkbutton id="Prev" text="<< Previous" onclick="Page_DataList" runat="server">
<asp:linkbutton id="Next" text="Next >>" onclick="Page_DataList" runat="server">
////////////////////////////////////////////////////////////////
public int GetSelectedIndexCOMMANDTYPE (string CT_REF)
{
int iLoop;
DataTable dt = ddlDataSet1.Tables["ddlCOMMANDTYPE"];
for (iLoop=0; iLoop < dt.Rows.Count; iLoop++)
{
string srow = dt.Rows[iLoop]["CT_REF"].ToString();
if(srow == CT_REF)
{
return iLoop;
}
};
return 0;
}
//////////////////////////////////////////////////////////////////
public DataSet BindTBCOMMANDTYPE()
{
OdbcConnection myConnection = new OdbcConnection("DSN=POS;UID=system;PWD=system");
// Populate the ddlDataSet1
myConnection.Open();
const string strSQLDDL = @"SELECT CT_REF, CT_DESCRIPTION FROM TBCOMMANDTYPE ORDER BY CT_REF";
OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
ddlDataSet1.Clear();
myDataAdapter.Fill(ddlDataSet1, "ddlCOMMANDTYPE");
myDataAdapter.Dispose();
myDataAdapter = null;
myConnection.Close();
return ddlDataSet1;
}
//***********************************************************************
|
|
|
|
|
Your question belongs in the ASP.NET forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I've put together a component that, upon a certain action, a window opens. I am opening that window directly below the component, aligned with the bottom edge. It works great and exactly as I need it to...until the UC form is contained within a mdicontainer.
I am currently determining the position to place the window by looking at the position of the current component and its parents. Apparently with mdicontainers, the child form is a parent and I cannot get the appropriate screen position because the application form creates an unknown offset.
private void GetRefLocation(Control controlIn, ref int top, ref int left)<br />
{<br />
<br />
Control controlParent = controlIn.Parent;<br />
Form parent = this.FindForm();<br />
<br />
if (parent == controlParent)<br />
{<br />
top += parent.Top;<br />
left += parent.Left;<br />
}<br />
else<br />
{<br />
int addHeight = 0;<br />
System.Type a = controlParent.GetType();<br />
string b = controlParent.GetType().FullName;<br />
if (controlParent.GetType().FullName == "System.Windows.Forms.Panel")<br />
addHeight = ((Panel)controlParent).BorderStyle == BorderStyle.None ? 0 : (((Panel)controlParent).BorderStyle == BorderStyle.FixedSingle ? 1 : 2);<br />
<br />
top += controlParent.Top + addHeight;<br />
left += controlParent.Left;<br />
GetRefLocation(controlParent, ref top, ref left);<br />
}<br />
}
What do I really need to do to determine the position within the screen? I followed a couple trails involving GDI but I never found a way that I can set component.Location based on the screen position, let alone position of another component.
Thanks
|
|
|
|
|
dbetting wrote:
What do I really need to do to determine the position within the screen?
Use the PointToScreen and PointToClient methods of Control class to convert a location from client coordinates to screen coordinates respectively the other way round.
www.troschuetz.de
|
|
|
|
|
Thank you very much. With the code below, I eliminated the entire routine previously shown. I suspected it would end up being something simple.
Point newPos = PointToScreen(this.Location);<br />
newPos.Y = newPos.Y - this.Top + this.Height;<br />
newPos.X = newPos.X - this.Left;<br />
popup.Location = newPos;
Once I had screen position, all I had to do is offset the position by the local form position and it seems to pass the test regardless of depth of the User Controls on the form.
Thanks.
|
|
|
|
|
|
Sorry for the newbie question! I'm trying to write hex values into a file.
I started out using a streamwriter and writing a string:
"\x48\x41\x53\x48\x0D\x0A\xff\x00\x00\x01"
This worked fine, except that when looking at the output file in a hexeditor I got
48 41 53 48 0D 0A C3 BF 00 00 01
Where is should have read FF there was C3 BF!!
The same happens if I create an array and write that using a binary writer, ie:
char[] temp = new char[] {'\x48','\x41','\x53','\x48','\x0D','\x0A','\xFF','\x00','\x02','\x00','\x00','\x00','\x01','\x00','\x00','\x00'};
The only way I can do it is to convert all the hex to decimal and write it that way with a binarywriter:
byte[] temp = new byte[] {72,65,83,72,13,10,255,0,2,0,0,0,1,0,0,0};
But this is a pain, can anyone tell me how I SHOULD be doing this.
Thanks, in advance,
Chris
|
|
|
|
|
Any TextWriter or TextReader uses an Encoding to encode and decode bytes from and to text. More than likely it is the encoding that decided there was a better alternative, though that's just an educated guess.
You might consider using the ASCIIEncoding which is always single-byte characters, so 0xC3 0xBF isn't replaced with a "more suitable" character.
What are you writing binary characters to a file, though? If you are just trying to write the equivalent Unicode characters, you can specify Unicode in C# using \uXXXX .
Otherwise, you could use a Stream to write the entire binary file, and when you need to write text use the Encoding you find appropriate, like ASCIIEncoding or UTF8Encoding (which is nice, since for the ASCII character set (first 128 bits) it looks like an ASCII file but can handle other characters sets like Unicode without using a codepage).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath,
Thanks for that comprehensive reply! I have tried changing the encoding method, but to no avail it changes the output - but it still isn't right!
Here is the code I am currently playing with:
FileStream outputFile = new FileStream(destination, FileMode.CreateNew);
BinaryWriter outputBin = new BinaryWriter(outputFile,System.Text.Encoding.ASCII);
char[] temp = new char[] {'\x48','\x41','\x53','\x48','\x0D','\x0A','\xFF','\x00','\x02','\x00','\x00','\x00','\x01','\x00','\x00','\x00'};
outputBin.Write(temp);
The ouput it produces is:
ASCII:
48 41 53 48 0D 0A 3F 00 02 00 00 00 01 00 00 00
Which is closer to what I want (in that FF is replaced with only 1 char not 2 as previously), but is still wrong.
I tried unicode as well, just for giggles, and that did work and produced an FF as required. Unfortunately the file I wish to write is to be read by another piece of software which requires a very specific format(not unicode).
Been at this hours now - brain melting....
|
|
|
|
|
I definitely think it's the encoding, especially if it worked under Unicode. If you're trying to write binary data, though, you can just use the FileStream itself instead of a BinaryWriter . You also should take a look at the using statement to make sure the streams are disposed, like so:
using (FileStream file = new FileStream(...))
{
} Sorry, just something I really think people should do when working with objects with ties to native resources.
Anyway, anything over 0x7f using encodings like UTF8 mean that 2 bytes should be used. IIRC, some codepages work this way, too. So, make sure you're using the right codepage (you can pass this to the Encoding class you need).
If I were you - and I do this a lot - dig through the IL using ildasm.exe or a decompiler like ".NET Reflector" to trace through the code itself to see what happens when you call BinaryWriter.Write or BinaryWriter.WriteLine and see how the Encoding class is used. Then see how the Encoding class derivative you're using works.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|