|
A boolean statment is true or false(1 or 0)key is on or key is off.
Anyway we have fazzy logic that it says we have many states between 1 and 0
|
|
|
|
|
I would say that false == 0, and true is a value that is not 0.
In most circumstances true == 1, but VARIANT_TRUE == -1, if my memory serves me right.
-- modified at 7:54 Monday 9th October, 2006
I found it at MSDN.
Here[^]
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Your memory is better than me
|
|
|
|
|
I did the mistake to test for true in a COM component once, that's why I remember. It just didn't work, so I had to find out why.
And the stuff we learn the hard way, that stuff stays.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
You are correct. false or FALSE is equal to 0, but when testing, you should assume true or TRUE (especially TRUE) is simple !false .
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I tried to use InternetSetOption() function to change or set options on IE some many times (a win32 function which is included in wininet C++ library)
and when i use any internet dial up i see the same settings like connection
time out, authotification..
This is my new function to call in WINMAIN entry point:
#include "stdafx.h"
#include "wininet.h"
...
//InternetConnectionOptions() function definition
BOOL InternetConnectionOptions()
{
INTERNET_PER_CONN_OPTION_LIST list;
BOOL bReturn;
DWORD dwBufSize = sizeof(list);
// fill out list struct
list.dwSize = sizeof(list);
// NULL == LAN, otherwise connectoid name
list.pszConnection = NULL;
// set three options
list.dwOptionCount = 3;
list.pOptions = new INTERNET_PER_CONN_OPTION[3];
// make sure the memory was allocated
if(NULL == list.pOptions)
{
//return FALSE if the memory wasn't allocated
return FALSE;
}
// set flags
list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT |PROXY_TYPE_PROXY;
// set proxy name
list.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
list.pOptions[1].Value.pszValue = "http://proxy:80";
// set proxy override
list.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
list.pOptions[2].Value.pszValue = "local";
// set the options on the connection
bReturn = InternetSetOption(NULL,
INTERNET_OPTION_PER_CONNECTION_OPTION, &list, dwBufSize);
//free the allocated memory
delete [] list.pOptions;
bReturn = InternetSetOption(hOpen,INTERNET_OPTION_USERNAME,
lpszUser, strlen(lpszUser)+1);//Here is the main problem !!
return bReturn;
}
note : hOpen is the Handle returned by InternetConnect() function
... and to be more specific when i go to Internet Explorer->Tools then Internet Options i see the same settings the username didn't change
Last Question: Why we couldn't include the first parameter as NULL in authentication setting (When we put the first parameter in InternetSetOption we mean that we change the defaulte setting .. Right??)
could someone tell me why its not working? or just
tell me how to use it well
Thank you.
"Anyone who considers arithmetical methods of producing random numbers is, of course, in a state of sin."
John von Neumann
|
|
|
|
|
Hi,
Ad.1.
Quote from MSDN about "INTERNET_OPTION_PER_CONNECTION_OPTION":
To refresh the global proxy settings, you must call InternetSetOption with the INTERNET_OPTION_REFRESH option flag. To set the settings on a per session basis, a valid session handle should be used.
Ad.2. You should probably use: INTERNET_OPTION_PROXY_USERNAME to set username for proxy auth. INTERNET_OPTION_USERNAME is used for InternetConnect for HTTP or FTP connections for example and not for Proxy authentication.
Hope that helps,
Best regards
|
|
|
|
|
Great thanks to you, i tried to add two functions :
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
but it still not working and i found an article for how to change Proxy settings "Change Internet Proxy settings" in this good web site in my program the changing 'default' setting is required not using a proxy i guess that you understand .. (i didn't find any method to change authotification
with default session WITH or WITHOUT InternetConnect returned hundle ).
Any idea ?
Anyone who considers arithmetical methods of producing random numbers is, of course, in a state of sin.
John von Neumann
|
|
|
|
|
You dont need to call InternetConnect function. The only function which is necessary for enabling Internet functionality in your app, is InternetOpen . You have to call this function in order to initialize all Wininet fucntionality in your app.
Calling InternetOpen , will give you HINTERNET handle which is used by InternetSetOption and others.
Best regards
|
|
|
|
|
Hi guys,
How to copy data from a stream into a structure?
Dhilleswar
|
|
|
|
|
by serialization ?
you must know the structure datas, and how the stream is built.
|
|
|
|
|
Hi,
If stream is a serialized version of structure, and its size and alignment is as it would be in the structure, you can use memcpy(dest, src, size) function.
For example:
...
SYSTEMTIME st;
GetSystemTime(&st);
DWORD dwSize = sizeof(SYSTEMTIME);
BYTE *pBuf = new BYTE[dwSize];
if (!pBuf)
return -1;
memcpy(pBuf, &st, dwSize);
memcpy(&st, pBuf, dwSize);
...
Hope that helps a bit...
Best regards
|
|
|
|
|
hello,
I am in trouble with parsing xml containing dataset data with xsl.
It worked ok if I saved the xml as file on disk, but fails if I want to do it in 'memory', the xsl cannot find the root element named Sales..., it does not find any items.
The c# code:
XslTransform xslTran = new XslTransform();
string xslPath=(string)this.configurationAppSettings.GetValue("EstInvoicePath",typeof (string));
xslTran.Load(xslPath); // loads the xsl
StringWriter swr = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(swr);
System.Xml.XmlWriter wx=xtw;
Store.Sales.WriteXml(wx,System.Data.XmlWriteMode.IgnoreSchema);
StringReader sr = new StringReader(swr.ToString());
System.Xml.XmlTextReader xtr= new XmlTextReader(sr);
System.Xml.XmlReader xr=xtr;
System.Xml.XPath.XPathDocument doc2= new System.Xml.XPath.XPathDocument(xr,System.Xml.XmlSpace.None);
xslTran.Transform(doc2.CreateNavigator(),null,w);
string textMy=sw.ToString();
the xsl fragment for testing: (Sales should be a root element)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance/" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:s="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="ms s xsi xsd">
<xsl:output method="html"/>
<xsl:template match="/">
<table>
<tr>
<td>
<img src="gfx/InvoiceLogo.bmp" border="0"/>
</td>
</tr>
<xsl:for-each select="Sales/SlsItem">
<tr>
<td>one Item found</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Can anybody give a hint please...?
|
|
|
|
|
if you have a C# code you can ask your question on C$ forum maybe you get your answer
|
|
|
|
|
Thank you, I solved my problem alredy with System.Xml.XmlNamespaceManager.
|
|
|
|
|
hi,
my query is like this
if(!recset1.Open( CRecordset::forwardOnly,
_T( "SELECT Controller_Name FROM T_controller WHERE Port_ID='0'") ,CRecordset::readOnly))
I want that my condition WHERE become a parameter WHERE Port_ID=str
how can i do this
thanks
|
|
|
|
|
so I tried this
wsprintf(szBuffer,"SELECT Controller_Name FROM T_controller WHERE Port_ID='0'");
if(!recset1.Open( CRecordset::forwardOnly,
szBuffer ,CRecordset::readOnly))
but when i change Port_ID='0' with Port_ID=str I have a problem when running the programm
I declare CString str="0"
|
|
|
|
|
use CString::Format() .
you first format the string (sql query) with the parameters it has to receive, and then forward it...
|
|
|
|
|
sorry but I don't understand
|
|
|
|
|
wsprintf(szBuffer, _T("SELECT Controller_Name FROM T_controller WHERE Port_ID='%s'"), str);
|
|
|
|
|
I agree with tocct why you dont use of CString::Format
|
|
|
|
|
Regardless of whether CString::Format() or sprintf() is used, it has to be used correctly. Simply shoving MFC at the problem is not an automatic fix.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi DavidCrow,
how are you
Generaly I dont use from wsprintf because:
From the MSDN
"Security Alert Using this function incorrectly can compromise the security of your application"
|
|
|
|
|
Hi,
call to "COleDateTime::GetCurrentTime()" get crashed in my MFC aplication.
I am using Windows XP, SP2.
Development environment is Visual Studio 6 with Platform SDK for XP SP2.
Thanx in advance.
|
|
|
|