|
That's not C++, it looks like Managed C++ (which isn't really C++ but a different language based on it). This is the wrong forum for code like that.
Steve
|
|
|
|
|
One minute of googling turned up this code:
#include <stdio.h>
#include <stdlib.h>
extern char**_environ;
int main(int argc, char *argv[], char *envp[])
{
char **next = _environ;
while (*next)
{
printf("%s\n", *next);
next++;
}
return 0;
}</stdlib.h></stdio.h>
If you want to get the value of a specific variable you can use GetEnvironmentVariable()
|
|
|
|
|
I had created variable in user section , using the following code
'defining variables
dim objShell, colUserEnvVars
'initializing all variables
Set objShell = WScript.CreateObject("WScript.Shell")
Set colUserEnvVars = objShell.Environment("System")
'Output File for registry information.
colUserEnvVars("rahul") = "rahul"
but i cannot read the same from c++, for this i have to restart the system,
but Wscript.Echo colUserEnvVars("DeloitteAuditShare123") read the value without restarting ths system.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
GetEnvironmentVariable( ) will work from VS2005 onwards. Have you tried that.
|
|
|
|
|
VKupunaram wrote: from VS2005 onward
This API has been around since Windows NT 3.1 which was released in 1993. What makes you think that it is supported only from VS2005 onwards?
|
|
|
|
|
I am using an object of CMapStringtoString. How should I clean up the map contents in the destructor.
|
|
|
|
|
|
Can Any one please help me to get the screen shot of the windows opened in the desktop on CE Device machine. How would the screen shot be saved as bitmap file in the device machine.
A code snippet would be help ful.
Thanks in Advance
|
|
|
|
|
You need to have prnt_scrn.exe for capturing screen shot on a WinCE device.
Syntax of the Print Screen Tool
Prt_scrn [–d NUM] [-s Num1Num2] [–e Num1Num2] filename
Parameters of the Print Screen Tool
-d NUM
Specifies a number of seconds NUM to wait after running the Prt_scrn.exe application before taking the screen shot. The default value for NUM is zero.
-s Num1 Num2
Specifies the location of the upper left vertex of the rectangular region on the screen where to take the screen shot. The values Num1 and Num2 specify, in pixels, the horizontal and vertical coordinates, respectively, of this vertex. The default values for Num1 and Num2 are zero. The default values specify that the upper left vertex is the upper left corner of the screen.
-e Num1 Num2
Specifies the location of the lower right vertex of the rectangular region on the screen where to take the screen shot. The values Num1 and Num2 specify, in pixels, the horizontal and vertical coordinates, respectively, of this vertex. The values for Num1 and Num2 must be greater than the values specified in the -s parameter. The default value for Num1 is the width of the screen in pixels minus one pixel and the default value for Num2 is the height of the screen in pixels minus one pixel. The default values specify that the lower right vertex is the lower right corner of the screen.
filename
Specifies the path and file name of the .bmp file where to save the screen shot. To save the .bmp file to the release directory, add a \release\ prefix to the file name. The filename parameter is a required parameter.
Examples
The following code example shows syntax that instructs the Print Screen tool to take a screen shot on the target device three seconds after running Prt_scrn.exe. This example sends the screen shot to the Snapshot.bmp file in the release directory.
Prt_scrn –d 3 \Release\Snapshot.bmp
The following code example shows syntax that instructs the Print Screen tool to take a screen shot of the (100, 100, 400, 400) screen region on the target device. This example sends the screen shot to the Snapshot.bmp file in the Windows directory on the target device.
Prt_scrn –s 100 100 –e 400 400 \Windows\Snapshot.bmp
|
|
|
|
|
|
Hi..
I am new to this code project..
I have doubt on Visual c++..
My task is to scan the image and find the text in visual c++..
Once if i scan the alphabet it should called the library data base....
1.Create data base
2. How to include the images in the data base
3.Should we include the images in library files..
4.How to call the library files..
Could some one help me out ....
Thanks
|
|
|
|
|
You better seperate the images out of the database as separate image files in the desired format. In the database I would only list the relative path (!!!) to the image of an image directory or server.
Consider changing the image storage for the future!!!
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I want to retrieve handles for all the windows opened in wince machine. Using my application i need to retrieve the handle for the windows that has been opened in desktop and list the title of those windows in a list view .
Thanks in Advance.
|
|
|
|
|
|
I have tried with the folowing code snippet.Still i am not able to retrieve the handle for the window.
WNDENUMPROC lpEnumFunc = &EnumWindowsProc;
TCHAR szName[50];
HWND hTempWnd = NULL;
lpEnumFunc(hTempWnd,lParam);
if(EnumWindows(lpEnumFunc ,LPARAM(hWnd)))
MessageBox(hWnd,L"EnumWindows Successful",NULL,0);
lpEnumFunc(hTempWnd,lParam);
GetWindowText(hTempWnd,szName,50);
MessageBox(hTempWnd,szName,szName,0);
|
|
|
|
|
Well, well try, If that API was supposed to work as per your understanding there are possible risks being caught in an infinite loop or referencing a destroyed window handle.
Call Back functions of an Windows API are not that supposed to be called by you.
struct MYLISTVIEW
{
};
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
#define MAX_TEXT_LEN 256
MYLISTVIEW *plvData = (MYLISTVIEW *)lParam;
if (plvData)
{
TCHAR szWndText[MAX_TEXT_LEN] = _T("");
LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
LONG lExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
if (IsWindowVisible(hwnd) && !GetParent(hwnd) && hwnd != GetDesktopWindow() && (
!(lExStyle & WS_EX_NOACTIVATE || lExStyle & WS_EX_TOOLWINDOW)))
{
RECT rc = {0};
GetWindowRect(hwnd, &rc);
if (rc.bottom - rc.top && rc.right - rc.left)
{
GetWindowText(hwnd, szWndText, MAX_TEXT_LEN);
AddWndTextToListView(plvData, szWndText);
}
}
}
return TRUE;
}
MYLISTVIEW g_lvData;
void AddOpenedWindowsToListView()
{
EnumWindows(EnumWindowsProc, (LPARAM)&g_lvData);
}
|
|
|
|
|
I am new to visual studio 2008 and I am stuck. Below is a brief summary of the code and the error that accompanies it. I have tried a bunch of fixes to no avail. Perhaps I do not understand the error could someone please help me? Any suggestions would be appreciated.
CString s;
for(int i=0; i< ROIData.GetCount() ; i++)
{
ROIData.GetText(i,s);
sscanf((LPTSTR)((LPCTSTR) s),_T("%s %d %d %d %d %d d"),&tmp,&temp.lbk.l,&temp.lbk.u,&temp.pk.l,&temp.pk.u,&temp.ubk.l,&temp.ubk.u);
temp.label.Format(_T("%s"),tmp);
m_arROI.Add(temp);
}
The error that accompanies the is "error C2664: 'sscanf : cannot convert parameter 1 from 'LPTSTR' to 'const char *'"
I would be happy to provide any other information I can if any more is needed.
Thanks in advance!!!
|
|
|
|
|
|
xzing wrote: sscanf((LPTSTR)((LPCTSTR) s),_T("%s %d %d %d %d %d d"),&tmp,&temp.lbk.l,&temp.lbk.u,&temp.pk.l,&temp.pk.u,&temp.ubk.l,&temp.ubk.u);
As side note to Stuart's reply, you don't need neither (LPCTSTR) , nor (LPTSTR) .If you cannot spot why, then you should read again, carefully, the article suggested by Stuart.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
is there a difference in how menu items are processed in Doc-View apps vs. Dialog-based apps?
I am trying to work with the ON_UPDATE_COMMAND_UI callback in a Dialog-based app for a menu item in the Dialog's main menu.
(I posted my problem here [(Enable/Disable menu items^)]">)
It seems that within my ON_UPDATE_COMMAND_UI function, it doesn't execute the statement pCmdUI->Enable( FALSE ) - thus NOT setting the menu item as I want
Thanks!
|
|
|
|
|
john john mackey wrote: is there a difference in how menu items are processed in Doc-View apps vs. Dialog-based apps?
Yes.
See this article[^]
|
|
|
|
|
You are the frickin MAN!
thanks for the info!
|
|
|
|
|
Hi,
I have been doing some research regarding how to fit a specfied number of characters
In a Rich edit control the following article on the codeProject helped
"http://www.codeproject.com/KB/edit/richeditsize.aspx"
"Calculating a Rich Edit Control Minimum Size"
I get the Idea behind it however on thing is missing the Author starts with
a computation of half of the width of the Client area
int cxLast = ::GetSystemMetrics( SM_CXFULLSCREEN ) / 2;
If I want a certian number of characters to fix in the line of a rich edit control
wouldn't I want to know the Font of The Dialogbox/Richeditcontrol
would that mean instantating of CDC object
Doing a SlectObject getting the Logfont Structure
My question is "Am I losing it" meaning I am really making this more difficult then I have to ?????
Or am I on the right Path
thankx
|
|
|
|
|
ForNow wrote: If I want a certian number of characters to fix in the line of a rich edit control
wouldn't I want to know the Font of The Dialogbox/Richeditcontrol
That might well work for a mono-space font like Courier or Courier New. But what about proportional fonts like Arial or Times New Roman? With a font like that, the number of characters you can fit into a particular width depends on the characters you're displaying - 'W' is a lot wider than 'l'!!
ForNow wrote: would that mean instantating of CDC object
Doing a SlectObject getting the Logfont Structure
In a word yes. And then use GetTextExtentPoint32[^] to get the size of a string you specify or GetTextMetrics[^] (to get font metrics including average character width).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
First I think I finally Understand from your reply and the sample code in the above mentioned URL why they call RichEdittext bottomless ... cuase the height is always the same for a font while the width of each character varies
thats why in the sample code the author was looking for what particualr height will have the right richedit control
width
I know people here always tell me to do reasearch before asking my questions and this time I thought I did
but tell me what you think of this solution
Cfont* font richedit->GetFont();
LOGFONT lf;
font->GetlogFont(&lf);
now lf.lfwidth * richedit->Linelength(-1); // multiple the avergage width by the number of charcters on a line
In a relasted issue I cann't seem to get the notification handler to kick off, I thought that after issuing
Requestresize()Control would be passed to it, I made a breakpoint in the begining of the method and it was never
invoked???
below is 3 pices of information the 1) the declaration of the method 2) the message map entry 3) the actual method
I think I have them all coded correctly
1) afx_msg void OnRequestResize(NMHDR* pNMHDR, LRESULT* pResult);
2) ON_NOTIFY(EN_REQUESTRESIZE,IDC_RICHEDIT21,OnRequestResize)
3) void Show_storage::OnRequestResize( NMHDR* pNMHDR, LRESULT* pResult )
{
_ASSERT( pNMHDR->code == EN_REQUESTRESIZE );
// Storing the requested sized to be used in the binary search
.
.
.
thankx again
|
|
|
|