|
Yes, I'm quite familiar with the ways to start a new elevated process. However, when you attempt to create a new folder in explorer, the UAC prompt is not asking you to permit starting an elevated application. The UAC prompt is specifically saying file operation. How do I do the same?
I know elevated operations can be achieved by using COM components. It does not elevate the process - and that is not my goal. My goal is to perform a file operation with elevated permissions utilizing the UAC prompt for file operations.
With starting a new process, this is what I get: http://i.zdnet.com/gallery/240387-460-416.png[^]
This is what I want: http://kb.parallels.com/Attachments/5354/Images/User_Account_Control_administrator_dialog.png[^]
Thanks
------------
Edit: Looks like consent.exe is the actual prompt. No luck trying to invoke that using command line. After that an instance of DllHost.exe performed the operation - which screams "COM operation!"
modified on Thursday, June 25, 2009 9:10 AM
|
|
|
|
|
IFileOperation[^] may be the COM interface you seek on Vista+...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
how we paying online payment for employ in asp.net
|
|
|
|
|
ruchira jain wrote: how we paying online payment for employ in asp.net
I don't know. How you paying online payment for employ in asp.net?
Oh sorry, I thought this was the start of a joke. I have no idea what you are on about. Online payment; are you talking about their salary? If so, you'll need some form of bank system in place - a common mechanism to pay employees here in the UK is through BACS - what you choose will depend on where you live.
"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
|
|
|
|
|
If you want to initiate online payment from your site you need a Merchant account in a Bank, a site verified by a certificate authority like verisign with https.
If a customer comes to your page and tries to make online payment he will be redirected to bank's website. From there the customer will enter his account no, password and amount everything.
Or you can use paypal.com
Please correct me If I mistake.
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
Is it possible in .NET (preferably VB.NET) to have the context menu of the title bar in the client area of a form? What I mean is what is also implemented in IE7, i.e. if you right-click on the stop/refresh/back button, it shows the same context menu as you get when right clicking on the title bar. Also, in IE7, double clicking at empty space makes the window maximize, but I think that isn't too difficult to implement using .NET (doubleclick event of form).
Thanks.
|
|
|
|
|
pimb2 wrote: Is it possible in .NET (preferably VB.NET) to have the context menu of the title bar in the client area of a form?
I doubt that you can simply "move" the menu. You could use a ContextMenu [^] - you'd have to mimic the behaviour of the desired menu-items.
pimb2 wrote: Also, in IE7, double clicking at empty space makes the window maximize, but I think that isn't too difficult to implement using .NET (doubleclick event of form).
Sounds really annoying, but I'm sure that there are people who like the feature
I are troll
|
|
|
|
|
Oh thanks, I hadn't thought about the idea of just using a ContextMenu - I'm always thinking about MenuStrips etc, but of course a normal ContextMenu would look like very much the same - thanks
|
|
|
|
|
You're welcome
I are troll
|
|
|
|
|
Ah, I've looked into the WIN32 API and it worked well. So well that I've submitted an article about it to this website
|
|
|
|
|
Hello,
I made a server and client side application. Communication between them is through tcp/ip.
Server application (tcp server) is developed in Delphi 7 using Indy 9.
Client application is developed in VS2005 using CF.NET 2.0.
I want to find if connection between the server and the client is lost.
As far I read, the only way to know if the client has been disconnected is to write or read from the socket.
But it is not working. When the client is disconnected i try to send/read data to and from then network stream.
But no exception is raised or any other indication to sense that the client has been disconnected.
Even if the server is not started, when i try to connect no exception is raised.
Here is my code (Connect, ReadData and SendData functions):
private NetworkStream GetStream(int AWait)
{
NetworkStream ns = _tcp.GetStream();
int time = Environment.TickCount;
while (true)
{
if (ns.CanRead && ns.CanWrite) break;
if (Environment.TickCount - time >= AWait)
throw new Exception("Unable to get NetworkStream. TIMEOUT!!!", new SocketException());
}
return ns;
}
protected bool GetData(StringBuilder Data)
{
Debug.WriteLine("GET DATA");
if (!Connected)
{
Debug.WriteLine("GET DATA: NOT CONNECTED");
this._error = "GetData: Not connected.";
return false;
}
int cnt = 0, i = 0, start = 0;
bool Done = false;
bool ACKFlag = false, SOHFlag = false, EOTFlag = false;
string PartialStr = String.Empty;
DateTime dt = DateTime.Now.AddSeconds(10);
byte[] buffer = new byte[_tcp.ReceiveBufferSize];
NetworkStream ns = GetStream(10000);
do
{
Debug.WriteLine("GetData: LOOP");
if (!ns.CanRead) throw new Exception("Can't read from network stream.");
cnt++;
buffer.Initialize();
int bytes;
try
{
bytes = ns.Read(buffer, 0, _tcp.ReceiveBufferSize);
Debug.WriteLine("Received " + bytes + " bytes");
}
catch
{
Debug.WriteLine("read timeout");
continue;
}
while (buffer[i] != 0)
{
if (i + 1 > bytes) break;
ACKFlag = (ACKFlag || (buffer[i] == (byte)SEPARATOR.ACK));
Debug.WriteLineIf(buffer[i] == (byte)SEPARATOR.ACK, "ACK");
SOHFlag = (SOHFlag || (buffer[i] == (byte)SEPARATOR.SOH));
Debug.WriteLineIf(buffer[i] == (byte)SEPARATOR.SOH, "SOH");
EOTFlag = (EOTFlag || (buffer[i] == (byte)SEPARATOR.EOT));
if (EOTFlag) Debug.WriteLine("EOT");
if ((ACKFlag) && (EOTFlag)) break;
if (buffer[i] == (byte)SEPARATOR.NAK)
{
_error = Data.ToString();
int b; string tmp = string.Empty;
for (int k = 0; k < _error.Length; k++)
{
b = (int)_error[k];
if (b == (byte)SEPARATOR.US)
tmp += "\r\n";
if ((b >= 32) || (b == 0x0A) || (b == 0x0D))
tmp += _error[k];
}
_error = tmp;
Debug.WriteLine(_error);
return false;
}
if ( SOHFlag)
{
if (buffer[i] == (byte)SEPARATOR.STX)
{
start = i;
}
if (buffer[i] == (byte)SEPARATOR.ETX)
{
PartialStr = System.Text.Encoding.GetEncoding(1251).GetString(buffer, start, i - start + 1);
Data.Append(PartialStr);
Debug.Write("STX ");
Debug.WriteLine(PartialStr.Substring(1, PartialStr.Length - 2) + " ETX");
}
}
i++;
}
Done = (ACKFlag && EOTFlag);
dt = DateTime.Now.AddSeconds(10);
}
while ((dt > DateTime.Now) && !Done);
Debug.WriteLine(cnt + " iterations.");
if (!Done) _error = "TIMEOUT!!!";
if (!Done && !EOTFlag) _error = "Incomplate package has been received. EOT not received.";
return Done;
}
protected bool SendData(ArrayList Data)
{
Debug.WriteLine("SEND DATA");
if (!Connected)
{
Debug.WriteLine("SEND DATA: NOT CONNECTED");
this._error = "SendData: Not connected.";
return false;
}
NetworkStream ns = GetStream(10000);
byte[] buffer = new byte[_tcp.ReceiveBufferSize];
try
{
if (ns.DataAvailable)
{
Debug.WriteLine("SEND DATA: CLEAR INPUT BUFFER");
ns.Read(buffer, 0, _tcp.ReceiveBufferSize);
}
}
catch
{
}
Data.Insert(4, (byte)SEPARATOR.SOH);
Data.Add((byte)SEPARATOR.EOT);
byte[] b = (byte[])Data.ToArray(typeof(byte));
ns.Write(b, 0, b.Length);
Debug.WriteLine("SEND DATA: send " + b.Length.ToString() + " bytes.");
return true;
}
public bool Connect()
{
if ((this._host == "") || (this._port == 0)) { return false; }
try
{
if ((SystemState.ConnectionsNetworkCount <= 0) &&
(!SystemState.CradlePresent))
{
Disconnect();
_error = ResourceManager.Instance.GetString("s_NoWireless");
Debug.WriteLine("NO WIRELESS");
return false;
}
try
{
Debug.WriteLine("PING TO HOST");
_connected = PING();
if (!_connected) Disconnect();
}
catch
{
Debug.WriteLine("EXCEPTION: NOT CONNECTED");
Disconnect();
}
if (!Connected)
{
Debug.WriteLine(string.Format("CONNECT TO HOST {0}:{1}", _host, _port));
if (this._tcp == null) { this._tcp = new TcpClient(); }
this._tcp.Connect(this._host, this._port);
_connected = true;
Debug.WriteLineIf(!_connected, "Poll says: NOT CONNECTED");
if (Connected)
{
try
{
Debug.WriteLine("PING TO HOST");
_connected = PING();
if (!_connected) Disconnect();
}
catch
{
Debug.WriteLine("EXCEPTION: NOT CONNECTED");
Disconnect();
}
}
else
{
_connected = false;
_error = "Can't connect to server.\r\n";
Debug.WriteLine(_error);
}
}
}
catch (Exception e)
{
Debug.WriteLine("CATCH EXCEPTION");
_error += e.StackTrace + "\r\n" + e.Message;
Disconnect();
TMessageList.AddMessage("Connect() > ", e);
}
return Connected;
}
private bool PING()
{
bool res = false;
try
{
ClearDataBuffer();
_result.Length = 0;
AddNumberToDataBuffer((int)COMMAND.PING);
AddSeparatorToDataBuffer(SEPARATOR.STX);
AddStringToDataBuffer(GSC.DeviceId);
AddSeparatorToDataBuffer(SEPARATOR.ETX);
AddSeparatorToDataBuffer(SEPARATOR.STX);
AddASCIINumberToDataBuffer(GSC.TermialNumb);
AddSeparatorToDataBuffer(SEPARATOR.ETX);
res = SendData(_data);
if (res)
{
res = GetData(_result);
}
}
catch
{
res = false;
}
finally
{
ClearDataBuffer();
_result.Length = 0;
}
return res;
}
Stanislav Stoqnov
modified on Tuesday, June 23, 2009 7:51 AM
|
|
|
|
|
Hello,
I manage to make it work.
After connect, read or write I check the _tcp.Client.Poll(...).
|
|
|
|
|
Normally, when no actual data is being exchanged on a TCP connection, no packets will be sent in either direction. If the connection is lost, one may wait forever to receive data without any clue that anything is wrong.
Most TCP stacks, however, offer a 'keepalive' time setting. When this is enabled and the indicated amount of time has elapsed since the last packet exchange, the "bored" machine will pretend that it hasn't received the acknowledgment for the last byte of data it sent, and will thus resend it with an indication that it is a retransmission that needs acknowledgment. The other machine should receive this and acknowledge it appropriately. If the other machine has dropped the connection but is presently running, it will immediately send a reset and kill the connection. If the other machine is not running or is not accessible, the "bored" machine will detect the acknowledgment failure after a minute or so and drop the connection itself.
|
|
|
|
|
how can edit the reports at run time?
bah10z
|
|
|
|
|
Hi,
I am designing an architecture in .NET framework. I use the Three tier model to design my application but I have a concern about how is the way to properly model the access to database layer. I have separate DLL for each layer.
In my business layer I want to access the database, for example to add new registry in a way that the members are not passed each one in a parameter but all in a single object. For example:
namespace myapp.bussines_layer
{
class Point
{
int x;
int y;
MyDatabase db = new MyDatabase();
void InsertInDatabase()
{
db.NewRowInDB(this);
}
void InsertInDatabase()
{
db.NewRowInDB(this.x, this.y);
}
}
}
The thing is that this way I have circular dependency because Point knows MyDatabase; and MyDatabase has to know Point in order to recognize Point as an parameter in the function.
Does my idea fit correctly in the good practices and designs to access databases? Is better design to pass all the parameters as native types (even when the amount os parameter is high)??
I would be very grateful if anyone could help me and/or give me references to good design patterns with the connection between business and database layers.
Thank you very much in advance.
Julen.
|
|
|
|
|
Julen wrote: The thing is that this way I have circular dependency because Point knows MyDatabase; and MyDatabase has to know Point in order to recognize Point as an parameter in the function.
Point is a predefined type; it is declared externally of both DLL's. You can do the same thing for your own classes, to avoid circular references.
Julen wrote: I would be very grateful if anyone could help me and/or give me references to good design patterns with the connection between business and database layers.
The dOOdads[^] architecture was a nice example. It's deprecated by now, but it's clean and readable code. Fastest way to dive into that code is to use the myGeneration application to generate a small testapplication that contains them dOOdads.
I are troll
|
|
|
|
|
Eddy Vluggen wrote: Point is a predefined type; it is declared externally of both DLL's. You can do the same thing for your own classes, to avoid circular references.
In this case Point is just an example; my class is one of my own that has at least 10 members. If I include this class in both DLL, would'n I be breaking the separation between the business and data layer?
|
|
|
|
|
Create a separate DLL for OwnClass , and reference it from both assemblies. The separation is one of responsibilities, not of classes; you're going to pass data from one DLL to another (or, from one layer to another) - and you'll need some common ground for them to talk to each other.
In pseudocode;
class Person { string Name; }
class DALPerson: Person
{
public DALPerson(string connectionString)
{
Name =
}
}
class BLPerson: DALPerson
{
public override ToString()
{
return "High Lord " + Name;
}
}
We have met the enemy, and he is us
|
|
|
|
|
its very simple
|
|
|
|
|
Once you know it, yes
I are troll
|
|
|
|
|
Julen wrote: would'n I be breaking the separation between the business and data layer?
Not necessarily.
As mentioned by others, the class could be external to both layers, or it could be defined in the lowest layer that uses it (probably the business layer).
And layers aren't necessarily tiers; don't confuse the two concepts.
|
|
|
|
|
Oh; that's nice to say because I thought both concepts mean the same. What is the difference?
|
|
|
|
|
The logical layers are the conceptual division, the tiers are the physical division.
(Source[^])
I are troll
|
|
|
|
|
Julen wrote: I use the tree tier model
It's "three-tier", as in the number 3, not "tree tier".
modified on Sunday, June 21, 2009 11:48 PM
|
|
|
|
|
Dave Kreskowiak wrote: It's "three-tier", as in the number 3, not "tree tier".
Sorry for the spelling.
I don't dislike creating a separate DLL to come to a common ground between layers. So, if I have three tier architecture; will I have 5 DLL? Three for the layers themself; and two for the common grounds?
Presentation layer -- Common ground 1 -- Bussiness layer -- Common ground 2 -- Data Layer
Could recommend me an article, reference, matter on this issue?
Thanks!
|
|
|
|