|
thanks for your advice Guffa.
Dave
|
|
|
|
|
In my main form1.cs class i am instanting another form control which has form2 title and some fields. So how can i make form2 pinned like anyothe application support this feature. I googled couldn't get much usful info may be you may show me Thanks
|
|
|
|
|
What exactly do you mean by 'pinned'?
Dave
|
|
|
|
|
I meant that I want to create the same effect a Toolbox or Properties windows provides in visual Studio. We can pinned or snap in and close them. Each window has its on title. So how can i make my form2 behave the same way in my form1. I know i got to use timer for open or closing the window but i am mostly concerned about its visual appreance and functionality. Thanks
|
|
|
|
|
This[^] may give you a starting point.
Dave
|
|
|
|
|
Hi,
I Have two tables.
Table1 has the following columns:
TableID
FieldID
FieldName
FieldValue
DateAdded
and Table2 has the following Columns
FieldID
TableID
Dataadded
And I want to display Each FieldName as a Column name for Dridview control and FieldValue as Value for each column. How can i form SELECT Statement To Achieve this ?
Thanks in advance
sri
|
|
|
|
|
Your select will give you the column names and data in the format you are looking for, you just need to bind the result to your gridview
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Assalam-0-alaikum,
quite strange question. n e way, would u mind elaborating a bit more as the question is not clear.
Regards
Atif Ali Bhatti.
|
|
|
|
|
I've created a custom control named MyCs.
I added the MyCs control to My Form1 and called it MyCs1.
Now I want to add Control to MyCs1 in design mode. i.e. to drag a text box and add it to MyCs1.
(Such as what you do on panel control)
When I try it; the TextBox is added to Form1 and not to MyCs1.
Any ideas?
|
|
|
|
|
You probably need to inherit from a ContainerControl such as ContainerControl or UserControl .
|
|
|
|
|
You go leppie, keep those useless 1 answers coming.
|
|
|
|
|
Huh?
|
|
|
|
|
Somebody una-voted you on your answer above.
|
|
|
|
|
I dont see how it was useless though...
|
|
|
|
|
Neither do I, now go Google 'sarcasm'.
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Hi guyz!.. i'm trying to launch an application from a service with an elevated right. THe application actually needs admin rights to lock folders and read processes on the system. The code i tried to compose works when the active session is 0 but when I lock the account under session 0 and login into another session, it launches the application on the previous account, seeing the launch program after going back to the previous account. How can i Solve this problem?.
Here is my function using createprocessasuser()
******************************************************
IntPtr l_ptrBuffer = IntPtr.Zero;
int errorCode = 0;
bool ret;
IntPtr token = new IntPtr(0);
IntPtr dupedToken = new IntPtr(0);
UInt32 dwSessionID;
SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES();
sa.bInheritHandle = false;
sa.Length = Marshal.SizeOf(sa);
sa.lpSecurityDescriptor = (IntPtr)0;
PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
STARTUPINFO si = new STARTUPINFO();
si.cb = Marshal.SizeOf(si);
si.lpDesktop = "winsta0\\default";
si.dwFlags = STARTF.STARTF_USESHOWWINDOW;
si.wShowWindow = ShowWindow.SW_SHOW;
this.writetolog("token b4:" + token);
dwSessionID = WTSGetActiveConsoleSessionId();
this.writetolog("from exe: " + dwSessionID.ToString());
WTS_INFO_CLASS.WTSUserName, out l_ptrBuffer, out l_nBytes);
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_SESSIONID, out token))
{
this.writetolog("dili successful pag openprocesstoken");
}
this.writetolog("token mid:" + token + "current process: " + GetCurrentProcess());
const uint GENERIC_ALL = 0x10000000;
const int SecurityImpersonation = 2;
const int TokenType = 1;
ret = DuplicateTokenEx(token, GENERIC_ALL, ref sa, SecurityImpersonation, TokenType, out dupedToken);
if (ret == false)
{
this.writetolog("dili successful pag duplic8");
}
this.writetolog("duptoken b4:" + dupedToken);
SetTokenInformation(dupedToken, TOKEN_INFORMATION_CLASS.TokenSessionId, dwSessionID, (uint)IntPtr.Size);
CloseHandle(token);
ImpersonateLoggedOnUser(dupedToken);
ret = CreateProcessAsUser(dupedToken,
executable,
cmdLine,
ref sa,
ref sa,
false,
0,
(IntPtr)0,
null,
ref si,
out pi);
if (ret == false)
{
this.writetolog("ala ka create og process");
}
if (WaitForSingleObject(pi.hProcess, timeOut) != 0)
{
}
uint ec;
GetExitCodeProcess(pi.hProcess, out ec);
errorCode = (int)ec;
RevertToSelf();
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
CloseHandle(dupedToken);
return errorCode;
******************************************************
Please help me guyz. Thankz
|
|
|
|
|
in the settokenifromation part..... an error occured (memory access is invalid). I think the calling process does not have enough acces riths to this. BUt the service is running with a LOCALSYSTEM rights. PLease Help me guyz..
Thankz..
|
|
|
|
|
I would like to open a new e-mail with an attachment in the default e-mail program, similar to the functionality in WinZip's context menu. I can open a new e-mail, but I can't make it recognize the attachment. Anyone know how to do this?
|
|
|
|
|
|
I can confirm that they will disregard the attachment when using the mailto: link. This is the way that I have been trying to use. But it must be possible somehow. WinZip and several other archivers are able to do Zip and e-mail, so it must be possible.
|
|
|
|
|
Edit: Good morning!
It looks like the mystery is solved. When we started testing, we also deactivated the firewall and virus protection to assure that they don't interfere with the test. Now it appears that deactivating them was not enough. Nothing short from completely uninstalling the virus protection stopped it from terminatinhg my thread. There was no log and no notification whatsoever. This thing, supposedly inactive, simply determined that this application is unwanted and terminated the thread as soon as it tried to do it's job.
At least the honor of Win XP is now restored.
I have a strange problem with a small application I am working on.
Basically the application (for testing this is a simple console application) starts a new thread to receive and analyze mail messages and then send faxes to certain receivers in response.
The the thread processes incoming mails, parses them, creates new messages and sends those as faxes to the receivers. After that it goes to sleep for a few minutes and does the same in an endless loop. The loop can only be broken when a ThreadAbortException is received. Then all cleanup is performed and the thread terminates.
The whole thing is a little longer, so it makes no sense to post some code here. Also, all this works just fine on my development machine with Windows Vista and VisualStudio 2008.
Edit: Sorry, I forgot to mention that the application uses the framework 2.0
Now the puzzling part: When installed on a Win XP machine, practically every call to the framework is answered by a ThreadAbortException. Catching and ignoring it will change nothing. The exception comes when trying to connect to the POP3 mailserver, when reading a small XML configuration file, when trying to send the faxes...
Generally it looks like the framework under Win XP is constantly trying to kill my thread for unknown reasons. Also, strange enough, of all things Vista seems to have no problem with the thread.
Does anyone know what this is?
Edit: I have logged one of the cases when the exception pops up. The same happens at practically any other location from different methods, always from within the framework. In this case it's while trying the XML configuration:
Montag, 26. Mai 2008, 13:34:25
Allgemeiner Fehler in cFaxClientRAL
Thread was being aborted.
at System.Globalization.CompareInfo.CompareRegion(Void* pSortingTable, Int32 sortingLCID, String string1, Int32 offset1, Int32 length1, String string2, Int32 offset2, Int32 length2, CompareOptions options) Now why would this method try to kill my thread?
at System.Globalization.CompareInfo.Compare(String string1, Int32 offset1, Int32 length1, String string2, Int32 offset2, Int32 length2, CompareOptions options)
at System.Data.DataTable.Compare(String s1, String s2)
at System.Data.Common.StringStorage.Compare(Int32 recordNo1, Int32 recordNo2)
at System.Data.Index.CompareRecords(Int32 record1, Int32 record2)
at System.Data.Index.IndexTree.CompareNode(Int32 record1, Int32 record2)
at System.Data.RBTree`1.RBInsert(Int32 root_id, Int32 x_id, Int32 mainTreeNodeID, Int32 position, Boolean append)
at System.Data.Index.InsertRecord(Int32 record, Boolean fireEvent)
at System.Data.Index.ApplyChangeAction(Int32 record, Int32 action, Int32 changeRecord)
at System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState oldState2, DataViewRowState newState2)
at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge, Int32 position, Boolean fireEvent, Exception& deferredException)
at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32 pos, Boolean fireEvent)
at System.Data.XmlDataLoader.LoadTable(DataTable table, Boolean isNested)
at System.Data.XmlDataLoader.LoadData(XmlReader reader)
at System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
at System.Data.DataSet.ReadXml(String fileName)
at Lymez.FaxServiceModule.RAL.cFaxServiceRAL.FaxClient_GetList()
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
modified on Tuesday, May 27, 2008 3:44 AM
|
|
|
|
|
I suspect your Fax library needs a window handle to work.
|
|
|
|
|
I don't think so.
The issues between worker threads and the user interface are well known. The thread has no user interface at all. Receiving mails is done around sockets, reading the configuration basically is a call to DataSet.ReadXml() method and sending the faxes uses a COM-wrapper. All of this is held together by a parser and some routines to reassemble the parsed mails into new fax messages. There is nothing remotely like a user interface nearby.
Also, the thread is always being killed, even if it just checks the mailbox and finds nothing to process. Even trying to read the xml configuration results in the thread being aborted, long before ever trying to send a fax.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|
It was worth a guess
I am not sure what the issue would be. Here are some hints.
Try enable exceptions to be 'breaked' when throw in VS (Debug/Exceptions). The code from within ReadXml() could have some catch all scenario, and it is hiding the real exception. This can be seen too when throwing an exception from your comparer while doing an Array.Sort() .
|
|
|
|
|
I think we have it. It looks like the framework and Win XP are totally innocent. The virus protection was the culprit, even when it was supposed to be inactive. It valiantly protected us from our own application without any notice or log.
A while ago he asked me what he should have printed on my business cards. I said 'Wizard'.
I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.
|
|
|
|
|