|
Thanks Alok & Naveen.
I Have another Method also. But I don't know is it correct method or not.
CButton *but = (Cbutton*) GetDlgItem(IDD_CNT1);
but->UpdateData(TRUE);
Sethuraman.K
|
|
|
|
|
|
hi sethuraman,
declare control varaible for each edit box in the classwizard member variable tab.
call that method updatedata(bool) for corresponding edit box variable. and up date to true. then u can acheive ur goal.
eg code:
m_ctrlEdtVar1.UpdateData(true);
here m_ctrlEdtVar1 is the control variable for edit box one.
i hope now u understood.
bye
|
|
|
|
|
hi,
this is the alternate way of implementing.it is some what better way becz you are getting dynamically.
GetDlgItem(ID_of_EditBox_control)->UpdateData(bool);
eg code :
GetDlgItem(IDC_EDIT1)->UpdateData(true);
bye
|
|
|
|
|
Sethuraman.K wrote: ...i will call UpdateData(True).
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I am using SQL Server and VC++ 2005.
How to know programatically whether column type of a particular field is CHAR or VARCHAR using OLEDB or ODBC?
|
|
|
|
|
i believe that value you are retrieving from database in a "variant" variable
if so then you can differintiate using the variant type
types are:-
BSTR FAR* pbstrVal; // VT_BYREF|VT_BSTR. for varchar
char cVal; // VT_I1. for char
Regards,
Pankaj Sachdeva
"There is no future lies in any job"
"but"
"future lies in the person who holds the job"
|
|
|
|
|
With ODBC, you can use SQLColumns()
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'm writing some code to traverse an Xml document generated by XmlWriter. The document is extremely simple. It consists of a single element with a list of sub-elements storing some values as strings. I am having a problem using XmlReader to traverse the file to retrieve the results though.
I am running Visual Studio 2005 with .NET Framework 2.0.
Effectively what I want to do is to read each element, check a lookup table to see where to store the value associated with the element and move onto the next one. The problem is that I get a compile error when I attempt to use the EOF property.
<br />
int iRead;<br />
XmlReader ^xtr;<br />
xtr = XmlReader::Create(strFullPath);<br />
<br />
xtr->Read();<br />
<br />
while (!xtr->EOF)
{<br />
if ((xtr->NodeType == XmlNodeType::Element) && (xtr->Name == "AdminVal"))<br />
{<br />
iRead = xtr->ReadElementContentAsInt();
}<br />
else<br />
xtr->Read();
}<br />
Now the xtr->EOF does not work at all. It will not compile with it in place but if I replace it with a while(1) then it works 100% fine (except detecting the end of the list is a problem!). I know I can tell the end of the file state from the xtr->Read() return val but if the if statement is traversed, I do not get the opportunity to read the state.
The error listing is
error C2059: syntax error : '('
error C2143: syntax error : missing ';' before '{'
error C2039: 'xtr' : is not a member of 'System::Xml::XmlReader'
c:\windows\microsoft.net\framework\v2.0.50727\system.xml.dll : see declaration of 'System::Xml::XmlReader'
Is this a bug?
Thanks for any assistance!
|
|
|
|
|
What is EOF defined as? I suspect it may be a function in c++ and a property in c# etc so you would need to call it like a function
while(!xtr->EOF())
If that doesnt work, right click on EOF and select "Go To definition". You should be able to see how its been defined
|
|
|
|
|
Go to definition gives the following:
System.Boolean EOF { get; }
Member of System.Xml.XmlReader
Summary:
When overridden in a derived class, gets a value indicating whether the reader is positioned at the end of the stream.
Return Values:
true if the reader is positioned at the end of the stream; otherwise, false.
So it is definitely a property - like .Name which I used successfully several times. I think it is some sort of compiler/framework bug because even trying to assign a bool variable to xtr->EOF gives a compiler error.
EDIT: I should add that when stepping through the debugger (with while(1) instead of while(!xtr->EOF)) and looking at the properties of xtr, the EOF property IS listed and carries the expected value.
|
|
|
|
|
We just hit this one, it is because of a #define in stdio.h which defines EOF as -1. The easiest quick and dirty fix is to do a #undef EOF before the line in the file if the C library EOF define is not used further on.
|
|
|
|
|
Hello,
If I hve message map functions in the base class then do I need to have message map in the derived class ?
Regards
Prithaa
|
|
|
|
|
No. If the function is already added in the BEGIN_MESSAGE_MAP-END_MESSAGE_MAP of the base class itself then you needn't to add it the derived class unless you want to overide it.
|
|
|
|
|
hai..,
No need ...and not at all required in derived class.
Born to win...
|
|
|
|
|
Hello Friends,
I am trying to change the Desktop Wallpaper programatically. For that I am using IActiveDesktop Interface.But not getting success, I am not getting any compile or run time error but it fails to set the wallpaper.
I am using the following code to get the path of the current Wallpaper and to set the new Wallpaper.
But I am getting only one string each time I call the GetWallpaper(), It is a follow "C:\Documents and Settings\Administrator\My Documents\My Pictures\logo.jpg"
HRESULT hr;
int Count = 0;
IActiveDesktop *pActiveDesktop;
CoInitialize(NULL);
hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (void**)&pActiveDesktop);
WCHAR Wallpaper[MAX_PATH];
wcscpy(Wallpaper,L"c:\\a.bmp");
pActiveDesktop->SetWallpaper(Wallpaper,0);
pActiveDesktop->ApplyChanges(AD_APPLY_ALL | AD_APPLY_FORCE);
pActiveDesktop->GetDesktopItemCount(&Count,0);
pActiveDesktop->GetWallpaper(Wallpaper,MAX_PATH,0);
I also use the SystemParametersInfo API to do the same thing. But the problem is that it only wotks with .bmp file.
If you have any IDEA please tell me. Thnx in advance.
|
|
|
|
|
|
I see the code it same as i am using. And problem still persist.
Is there any way I can use SystemParametersInfo API to set .jpg or .jpeg images as wallpaper or retrive the path of that.
|
|
|
|
|
Pls have a look @ this. This work for me
#include <windows.h>
#include <wininet.h>
#include <shlobj.h>
//Main window procedure WinMain
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iShowCmd)
{
CoInitialize (NULL) ;
HRESULT hr;
IActiveDesktop *pActiveDesktop;
//Create an instance of the Active Desktop
hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (void**)&pActiveDesktop);
//Insert code to call the IActiveDesktop methods
LPCWSTR wcPath = L"C:\\123.jpg" ;
if (pActiveDesktop -> SetWallpaper (wcPath, 0) != S_OK)
{
//The method has failed...
}
pActiveDesktop -> ApplyChanges (AD_APPLY_ALL) ;
// Call the Release method
pActiveDesktop->Release();
CoUninitialize () ;
return 0 ;
}
Ajay
|
|
|
|
|
thnx,
When I check the error code after SetWallpaper it show '0'. that means "The operation completed successfully.". But wallpaper doesn't changed.
I am using like this.
if (pActiveDesktop -> SetWallpaper (Wallpaper, 0) != S_OK)
{
dError = GetLastError();
}
Can you tell me what can be the problem.
|
|
|
|
|
did u call the pActiveDesktop -> ApplyChanges (AD_APPLY_ALL) ; ?
Ajay
|
|
|
|
|
Yes using like this
pActiveDesktop->ApplyChanges(AD_APPLY_ALL | AD_APPLY_FORCE);
But its not working. and even GetWallpaper() show me the same string as I mention above. I tried to find it on google ,but everyone uses the code like me and it works.
|
|
|
|
|
Images that are not BMP (JPG, GIF...) will be converted to a temporary bitmap when you're selecting it from Display Properties, and this feature is functional when Active Desktop is activated.
You can find the temporary bmp file on
<windows drive="">:\Documents and Settings\<user>\Local Settings\Application Data\Microsoft\Wallpaper1.bmp
Ajay
|
|
|
|
|
yup. I know that. but I am using .bmp file right now. And not able to set the .bmp file as the wallpaper.
If I use the Following code to set the wallpaper it works file. But it doesn't work with .jpg or .gif file.
SystemParametersInfo(SPI_SETDESKWALLPAPER,100, Wallpaper, 0);
Is there any way I can use the above code to set .gif or .jpg image as wallpaper.
|
|
|
|
|
Has Active Desktop been enabled?
Your code worked fine for me.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|