Tao

Tao obeys its own inherent Nature

2007年8月30日

Correct Implementation of #import
It is important to invoke ADO correctly in your program, or you can have compiler errors. The following code demonstrates the correct way to use #import with Msado10.dll the MSADO15.dll:

#import <msado15.dll>            \
no_namespace \
rename( "EOF", "adoEOF" )

error C2011: 'EditModeEnum' : 'enum' type redefinition
error C2011: 'LockTypeEnum' : 'enum' type redefinition
error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
error C2011: 'DataTypeEnum' : 'enum' type redefinition
error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
error C2011: 'RecordStatusEnum' : 'enum' type redefinition

Here's the original solution in MSDN:
http://support.microsoft.com/kb/169496/EN-US/


 
posted @ 2007-08-30 18:39 wade 阅读(134) | 评论 (0)编辑 收藏

 

Show how to add script to the client in aspx file.

/// <param name="rbl">RadioButtonList to apply script to</param>
/// <param name="page">The Page the script is going to be appended to</param>
/// <param name="script">The script to append</param>
public static void SetRadioButtonListItemScript(RadioButtonList rbl, Page page, string script)
{
for (int idx = 0; idx < rbl.Items.Count; idx++)
{
RegisterClientObjectFunction(page, rbl, idx, script);
}
}

/// <param name="page">The Page the script is going to be appended to</param> /// <param name="rbl">RadioButtonList to apply script to</param> /// <param name="idx">the index of the radio button</param> /// <param name="script">The script to append</param> static private void RegisterClientObjectFunction(Page page, RadioButtonList rbl, int idx, string script)
{
StringBuilder sw = new StringBuilder();
if (!page.IsStartupScriptRegistered(rbl.ClientID + "_" + idx.ToString() + "script"))
{
sw.Append(@"<SCRIPT>");
sw.Append(@"document.getElementById('" + rbl.ClientID + "_" + idx.ToString() + "').onclick=function() {" + script + "return true;}");
sw.Append(@"</SCRIPT>");
page.RegisterStartupScript(rbl.ClientID + "_" + idx.ToString() + "script", sw.ToString());
}
}

static private void RegisterClientObjectFunction(Page page, CheckBox chk, string script)
{
StringBuilder sw = new StringBuilder();
if (!page.IsStartupScriptRegistered(chk + "script"))
{
sw.Append(@"<SCRIPT>");
sw.Append(@"document.getElementById('"+chk.ClientID + "').onclick=function() {" + script + "return true;}");
sw.Append(@"</SCRIPT>");
page.RegisterStartupScript(chk.ClientID + "script", sw.ToString());
}
}

 
posted @ 2007-08-30 18:34 wade 阅读(29) | 评论 (0)编辑 收藏

Add Command here to right button click in explore (Windows XP)

http://www.blogjava.net/Files/programmer/CMDHere.zip

  1. Download the file and unzip the file CMDHere.reg.
  2. Double click it to import into registry,
  3. Right click on any folder, you'll see there's a menu which is "Command here",
  4. Click it, you'll get into the cmd window with the current path is which you selected.


Or you can import the settings manually.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Prompt]
@="Command Prompt"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Prompt\command]
@="Cmd.exe /k pushd %L"


posted @ 2007-08-30 18:15 wade 阅读(37) | 评论 (0)编辑 收藏

Set readonly for input text

document.getElementById("ctrl_id").readOnly  = true; //pay attention to the readOnly, it's case sensitive.

 

Set option to unable to select for select control:

 

<option value="Genre" disabled="disabled">Genre</option>

 

Set select control to disabled (it has no readonly property):

 

<select disabled="disabled"></select>

 

Add a new option to a select control, it works under firefox 2.x and IE 5.x:

function addOption(select_ctrl, option_value, option_text){
var ctrl = document.getElementById(selectctl);

if(ctrl == null)
return;

var doc = ctrl.ownerDocument;
if (!doc)
doc = ctrl.document;

var opt = doc.createElement('OPTION');
opt.value = option_value;
opt.text = option_text;

ctrl.options.add(opt, ctrl.options.length);
}

 

Delete an option from select control:

selectctl.options[selectctl.selectedIndex] = null;

Delete all options from select control:

selectctrl.options.length = 0;

Change the css for an object:

document.getElementById("ctrl_id").className="SHOWN";

 
posted @ 2007-08-30 14:31 wade 阅读(34) | 评论 (0)编辑 收藏

导航

<2007年8月>
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

统计

常用链接

留言簿(5)

随笔分类

随笔档案

相册

Photo

搜索

最新评论

阅读排行榜

评论排行榜