|
As far as I know the only way is to actually try opening the file
only two letters away from being an asset
|
|
|
|
|
Does anybody know what is the problem in the below code. The InPtr returned by the funcion is always 0 means null. Why?
////////////////
public class ThumbnailExtractor
{
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acdb17.dll", CallingConvention = CallingConvention.Cdecl,
EntryPoint = "?acdbGetPreviewBitmap@@YAPAUtagBITMAPINFO@@PB_W@Z")]
extern static private IntPtr acdbGetPreviewBitmap(string filename);
static Bitmap GetBitmapFromDwg(string filename)
{
return Marshaler.BitmapInfoToBitmap(acdbGetPreviewBitmap(filename));
}
public Bitmap GetImage(string filename)
{
return GetBitmapFromDwg(filename);
}
}
///////////////////
Thanks in advance
|
|
|
|
|
Not sure where this acdb17.dll is coming from, but the EntryPoint is looking really strange.
In most cases you can simply p/invoke functions from Win32 DLLs by just declaring the static method with the same name as the function in the DLL.
The EntryPoint attribute is only neccessary if you want to (or have to) name you function differently.
So I'd suggest trying:
[DllImport("acdb17.dll")]
extern static private IntPtr acdbGetPreviewBitmap(string filename);
Does it work then?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Im building a Search facility and want to return a set of results (Done!)
The results are displayed in a GridView, but I want the user to click a row and then that client info will pop up in the text boxes:
a Sample:
string ConnectionString = "Data Source='db.sdf';";
SqlCeConnection connection = new SqlCeConnection(ConnectionString);
connection.Open();
string strLastName = textBox1.Text;
string strPostCode = textBox2.Text;
string strEmail = textBox3.Text;
if (!(textBox1.Text == null))
{
string SelectLastName = "SELECT OID, name, lastname, Postcode, Emailad FROM Eaddress WHERE lastname = '" + strLastName + "'";
SqlCeDataAdapter da = new SqlCeDataAdapter(SelectLastName, ConnectionString);
DataSet ds = new DataSet();
da.Fill(ds, "Eaddress");
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "Eaddress";
}
i have two text boxes called textbox1 and textbox2, when user clicks the row the name appears in textbox and lastname appears in textbox2.
example would help very much!!
Palestine
|
|
|
|
|
Look up textbox databinding.
|
|
|
|
|
Can someone explain this with an example of why you need it as part of your own implementation of the Virtual Path Provider class. I have read this over and over in MSDN and other articles and do not get what it's use is in a pratical example.
Palestine
|
|
|
|
|
Hello,
I was thinking the other day about how I would solve the following problem, but I just couldn't seem to come up with a really logical solution... or at least what I would think is a best practice. How would you handle the following?
Say I have winform client apps... any number of them. Lets say that this app has a couple web services. Okay, now lets say that one of the web service is like a broker web service... it also contains other web services. The client isn't aware of all the web services the broker service is hitting, the broker is responsible for knowing that. The point here is that we have a web service which may hit another web service, could be anything. Now, here's the hard part... getting all of the errors in case one happens. So client requests data from Service1. Service one then hits Service2, Service3 and Service4. Service3 errors out because the server that it's on is down. Service4 errors out because of a database issue or something. I want to return something back to the client listing all of the details of why the transaction failed (like in a log file or something), like
Success: Transaction to Service1 was successful
Success: Transaction to Service2 was successful
Error: Could not access Service3.
Error: Duplicate Primary Keys in Service4.
How do I handle this? Lets take it to another level and say that Service2 in itself might contain other services, so the transaction to Service2 was successful, but the transaction to Service2a failed for some reason.
The trick is keeping a single log file that contains all of the details on why various services failed, even if those service contain services which may have failed for some reason. What's the best way to handle something like this? I can't have every method return a bool if it passes or fails because it might already have a return value... So I can't just call GetData on Service2 and return a bool whether it passed or failed because it might already return a dataset... Does this make sense?
Keep in mind this is hypothetical, but I am just wondering what the best practice is in handling this type of scenerio.
Thanks!
Palestine
|
|
|
|
|
Hello
In your scenario, I believe the best practice would be messages. Each message contains the sender info, and the error message. The protocole, or implementation is totally up to you. There are million ways to communicate between different applications and services.
Hints:
- You can return success/failure messages, or only failure messages.
- You can put your messages in a queue and check it periodically, or handle it promptly.
- You can send the error message in the service output, or send it in a private stream.
I hope this would throw some light
Regards
|
|
|
|
|
I'd say instead of returning a bool type, return a object[] type. The elements in the object array can then be anything. Thus retuning a whole package of info regarding what had happend during the call to Service3. The return return object can tell you for example:
obj[0] : failed/success
obj[1] : error message
obj[2] : error code
obj[3] : some other usefull return
This obviously means that the size of the package returned might be big; in terms of bool bytes vs. object[] bytes.
i hope this helps.
|
|
|
|
|
I have a View menu item that offiers Large Icon, Details..... views. I would like to have the menu item have a checked sign when selected by a user and then remove the check sign when user selects a different view option.
Thank you.
Palestine
|
|
|
|
|
Tried It out and worked fine.
private void m_SortItem_Click(object sender, EventArgs e)
{
//Clearing check marks from all menu items
foreach (ToolStripMenuItem item in sortToolBtn.DropDownItems)
{
item.Checked = false;
}
//Selected the current item which is clicked.
m_SortItem.Checked = true;
}
|
|
|
|
|
Task Description:
Input to my Web Service From MQ Message Queue
The complete XML will be sent from the Message Queue
- <soapbody>
<parameter>'' 'C:\ofac\out\file110' 'cl_110' 'LN ONE' 'LN2' 'LN3' 'LN4' 'LN5' 'LN6' 'LN7' 'LN8' 'LN9' 'CN' 'PN' 'OTHERName' 'COUNTRY' 'DATA KHFUOISDUFIOUDFOIFUIOD BODY'
I want to read the parameter and send the
parameter Data forward to a process.
The results of the process should replace the value of parameter
and return the complete message received from the
queue.
I continually get this message when starting debug:
The property 'OneWay' on type 'System.Web.Services.Protocols.SoapMessage' cannot be serialized because it is decorated with declarative security permission attributes. Consider using imperative asserts or demands in the property accessors.
I am using Visual Studio .Net For development
Here's my code Snippet:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Configuration;
using System.Security;
using System.Security.Permissions;
using System.Data.SqlClient;
using System.Reflection;
using System.Xml;
namespace WebServiceGL1Way
{
///
/// Summary description for Service1.
///
//[WebService(Namespace="http://10.1.21.58/GlobalOneWay")]
public class Service1 : System.Web.Services.WebService, System.Security.IPermission
{
public Service1()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
// WEB SERVICE EXAMPLE
// The HelloWorld() example service returns the string Hello World
// To build, uncomment the following lines then save and build the project
// To test this web service, press F5
//[SoapDocumentMethod(OneWay=true)] - shot in the dark
[WebMethod]
public string GlobalService1(SoapMessage message)
{
//string msg = message.GetInParameterValue(0).ToString(); - don't know which one will get value!!!??
object param = message.GetType().BaseType.GetField("parameter");
string msg = param.ToString();
string sRunBuildXML = msg;
RunProcess(Session["BuildXML_Path"].ToString(),sRunBuildXML);
// replace returned message within element parameter
return message;
}
//............
What is missing?
Is the input formatted correctly as a soap message?
Is it really a string?
Palestine
|
|
|
|
|
1. I have a DataGrid.
2. I have a Form.
3. I have an Access DB.
4. I have a dataset.
The Form data is inserted into my DB in an isolated transaction.
After that transaction has completed, I reload my dataset which is binded to the DataGrid. I use a connection instance for me insert transaction, and another connection object for my "selects". Even though both connection objects are created from the same connection string (appended below), the data seems to not be updated with a follow up my completed transaction with a search on the newly inserted data.
Basically the data I'm submitting is not show up in my datagrid. It's like I have to wait a few seconds and search again to find it. Is Access really that slow. Why would it complete my insert and transaction if it's not done.
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=$$$\DocuBase.mdb;Mode=Share Deny None;Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False
Palestine
|
|
|
|
|
You'll have to use one instnce troughout your app(or form) of the adapter(adp1) and assosiated connection(con) when selecting, inserting, deleteing and updateing of the dataset(ds) if you want the data to be concurrent within your grid and reflect changes as it happens. The concurrency behind the dataset & grid are maintained by currencymanagers and currency happens 'automaticlly', but you'll have to use the original instances of dataset, adapter, commands and connections objects to preserve currency of the datasets and keep them in context of its original 'data factories'.
If you have 2 adapter; one for selecting and one for insetingon the same dataset table, you will have concurrency problems. Rember that the adapter knows the states of the rows during an fill or update - the adapter only gets/changes the rows whos states has changed and/or are different as those rows in the db.
you should buy a book explaning these stuff to you. Datasets are very powerfull, but they can irretate the hell out of you if you use it the wrong way.
|
|
|
|
|
I have upgraded from .net framework 1.1 to 2.0 and also changed from MS VisualStudio 2003 to 2005. My program was obsolutely working fine 2003 and i am getting the desired output.
I will tell the problem what it is, when i debug the appln. it is not going in to the method but just skipping that stmt . when i point the cursor to that line, it is showing the message "remove group, currently there is no group object."
here is the method where the problem lies
Hashtable htable = mUsersGroups.GetAllUsersAndIDs();
There is nothing wrong with the method and i got the output what i want in 2003 version , but the problem is doesn't filter acc. to group and show all the groups. But anyhow i can give the code for u'r better understanding.
public Hashtable GetAllUsersAndIDs()
{
long userGroupID;
UGUserNode user;
SqlConnection dbc = new SqlConnection(Config.ConnectionString);
Hashtable userTable = new Hashtable();
dbc.Open();
try
{
SqlCommand sqlCommand = new SqlCommand(
"SELECT DISTINCT UserGroupID, Name " +
"FROM UserGroupTable " +
"ORDER BY Name",
dbc);
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
while (sqlDataReader.Read())
{
if (!sqlDataReader.IsDBNull(0))
{
userGroupID = sqlDataReader.GetInt32(0);
if (nodes.ContainsKey(userGroupID))
{
//we have already seen this node!
user = (UGUserNode) nodes[userGroupID];
}
else
{
user = new UGUserNode();
user.LoginName = sqlDataReader.GetString(1);
user.UserGroupID = sqlDataReader.GetInt32(0);
user.IsActive = true;
nodes.Add(userGroupID, user);
}
userTable.Add(userGroupID,nodes[userGroupID]);
}
}
sqlDataReader.Close();
}
catch(Exception e)
{ Console.WriteLine(e.Message);}
finally {dbc.Close();}
return userTable;
}
I am not familiar with the MS VisualStudio 2005 and could not figure out what the problem is and can u resolve the problem and reply with the complete solution please,
Thanks,
Palestine
|
|
|
|
|
|
The first one can be achieved with GraphicsPath.AddArc() , followed by GraphicsPath.AddLine() to add the lower horizontal line. When you call FillPath() on your given Graphics object, the path will be closed automatically.
The second one is very similar, you'll add an Arc , a Line , and another Arc . You might have to set GraphicsPath.FillMode to FillMode.Winding in the second case or you'll get unexpected results.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Is it possible to compare two versions of dlls. To explain, if a class Library C, having several classes, is compiled to get C.dll with say version 1. After few months, class library undergoes some changes and a new version of C.dll is released, say with version 2. Now, Is it possible to compare C.dll of version 1 and 2.
if so, please guide me how to do.
TIA.
Ananth
|
|
|
|
|
Hello
You can always get the version of a file using The FileVersionInfo class. Here is an examplke from MSDN:
public void GetFileVersion() {
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo("%systemroot%\\Notepad.exe");
textBox1.Text = "File: " + myFileVersionInfo.FileDescription + '\n' +
"Version number: " + myFileVersionInfo.FileVersion;
}
Regards
|
|
|
|
|
Hi
Thanks for the info. But I need more than that.
Is it possible to compare two dlls (with different versions) having similar code base. For more details on the query, refer to my earlier posting.
Regards,
Ananth
|
|
|
|
|
Hello
In your earlier post you said
Ananthalvan wrote: Is it possible to compare two versions of dlls.(
So I understood that you need to compare the version itself -maybe I was wrong-
No you say
Ananthalvan wrote: Is it possible to compare two dlls
Yes, it's always possible. Yet, in what manner do you want to compare them?? By what exactly? By refering to your earlier post -as you said-, all you were talking about was classes. So if you want to get the names of te classes in a dll, just use Reflection.
Type "Reflection" in MSDN's index and you'll get more informations.
Regards
|
|
|
|
|
Dear Friends
I have an employee master form wiht having 5 tables. My requuirement is when the user opens the form, it must be the add new record mode. My problem is i can add new employee first time. After saving am reseting the dataset using clear(). After that when i add the next employee, it throws error saying the index out of range. This is when i refer the row[0] of the emp data adapter.
//*********** MY Reset script
dsEmp.Clear();
this.BindingContext[dsEmp, "HR_M_EMPLOYEE"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMPLOYEE"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMP_EAR_DED_EAR"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMP_EAR_DED_EAR"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMP_EAR_DED_DED"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMP_EAR_DED_DED"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMP_DOCUMENTS"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMP_DOCUMENTS"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMP_DEPENDENTS"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMP_DEPENDENTS"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMP_QUALIFICATIONS"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMP_QUALIFICATIONS"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMP_CERTIFICATION"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMP_CERTIFICATION"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMP_EXPERIENCE"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMP_EXPERIENCE"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMP_SKILLS"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMP_SKILLS"].AddNew();
this.BindingContext[dsEmp, "HR_M_EMPLOYEE_PHOTOS"].EndCurrentEdit();
this.BindingContext[dsEmp, "HR_M_EMPLOYEE_PHOTOS"].AddNew();
errEmpForm.Clear();
//*********** end of Reset script
When user save the employee, am setting some values to the hiden columns
Error is appearing here
this.BindingContext[dsEmp, "HR_M_EMPLOYEE"].EndCurrentEdit();
if (dsEmp.Tables["HR_M_EMPLOYEE"].Rows[0].RowState == DataRowState.Added)
{
dsEmp.Tables["HR_M_EMPLOYEE"].Rows[0]["N_COMP_CODE"] = GlobalMembers.gi_compcode.ToString();
dsEmp.Tables["HR_M_EMPLOYEE"].Rows[0]["N_USER_CODE"] = GlobalMembers.gi_usercode.ToString();
dsEmp.Tables["HR_M_EMPLOYEE"].Rows[0]["D_MODTIME"] = DateTime.Now.ToString();
}
What i need is after saving the employee, the form must be Add new record mode.
How can i achieve this. Am sure that am wrong somewhere. I dont know how can i do this. Even though am calling the AddNew using the binding contect, the new record is not reflecting.
I need help. If reuired the complete script i can send that also, it is very very big.
Plsss help meeee, i have the deadling next week.
Vinu M
|
|
|
|
|
I need Run Movie On Tv Using Video card
Topic Directx 9
Code In C# or vb.net
Problem Detai:
I want to run mpeg file in my form window which is design in (C# or Vb.net)
display should be simultaniusly form and TV (AV1 chanal).
Thanks
i wana script
i wana script
|
|
|
|
|
Dear Experts,
I have searched for days everywhere for an example on how to do this, and found many examples, but none of them do exactly what is needed.
I have a C# application where I need to drag files from a listview that are compressed in an archive to an Explorer window, and need to execute custom decompression code to extract the files after they are dropped. This decompression can take quite long if the files are large. There are no examples how to do this anywhere. This is currently being done in WinZip and WinRAR, so it appears to be possible.
This link shows a method that seems promising and most articles point to it:
http://blog.joycode.com/felix/articles/38825.aspx
In this article he creates a custom DataObject with an override for the GetData method. I still cannot make it work. The files get moved but are 0 length. It must have something to do with the timing of when the events and methods fire. I guess I don't fully understand the entire sequence of events.
If we can only get the path to the drop folder, but that is not possible.
This exact question was asked on EE, but the author finds out how to do it before a solution is posted and does not really share it in enough detail to help other users:
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_21554101.html?query=drag+drop+explorer&topics=323
If anyone has implemented this, please help.
-Frank
|
|
|
|
|
more info...
The sample from blog.joycode.com should work, but I guess I don't understand the order events happen. If you look at the code below, I adapted the custom DataObject for my application based on what was in the article. When you drop the items, GetData() gets called multiple times. My custom UnzipFiles() gets called, and the files get extracted to the temp folder where the original temp files were created when I first start the drag from the list. But it seems that it copies the zero length files before the extracted versions get created. It's definitely a timing issue.
public class ShellDataObject: DataObject
{
private bool downloaded = false;
private DlgExtract _dlg;
public override object GetData(String format)
{
Object obj = base.GetData(format);
if (System.Windows.Forms.DataFormats.FileDrop == format && !InDragLoop() && !downloaded)
{
_dlg.UnzipFiles(System.IO.Path.GetTempPath(), _dlg.ZipContentsList.SelectedItems);
downloaded = true;
}
return obj;
}
public DlgExtract BaseDialog
{
set { _dlg = value; }
}
private bool InDragLoop()
{
return (0 != (int)GetData(ShellClipboardFormats.CFSTR_INDRAGLOOP));
}
}
|
|
|
|
|