|
Thanks, but it won't work - when the main batch calls the sub batch the sub batch will set the variable in its own environment, but then it disappears again when the sub batch returns to the main batch.
Dave
Dave
|
|
|
|
|
Are you sure? I've tested this on my XP Pro. When you execute b1, SET displays var with the value of 'foo'.
rem b1.bat
call b2.bat
set
rem b2.bat
set var=foo
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Consider using Windows Scripting Host (WSH) - it is intended exactly for such purposes. In WinNT WSH is available after installing Option Pack 4. In WSH you write scripts using Visual Basic Scripting Edition.
|
|
|
|
|
This is a common problem I face in MFC, and presumably theres a simple answer.
I created a dialog template, and loaded this fine from my CMainFrame, docking it also:
CDlgBar *Dlg = new CDlgBar();
Dlg->Create( this, IDD_DIALOG1, CBRS_LEFT | WS_CHILD, IDD_DIALOG1 );
Dlg->ShowWindow( SW_SHOW );
However, I then wanted to add some code to the Dialog template. So I press ctrl+w in the dialog designer and create a class to hold the dialog template. First problem is that I cant create an MFC class to inherit from CDlgBar. Why?!!! Anyway, I decided to inherit from CDialog and change all references to CDialog to CDialogBar manually. This is a lot of work (as we have to change the base class call etc.)
Being as Visual Studio doesnt let me inherit from CDlgBar I presume there is a reason I shouldnt be doing this?
I just found this note at Microsoft:
Because ClassWizard does not support deriving a class from CDialogBar, this
article shows the steps necessary to create a class from CDialog and then
"convert" the class to CDialogBar.
I guess my question is why doesnt ClassWizard support it?
Thanks
Chris
|
|
|
|
|
Hmmm.... Q99161 HOWTO: Derive From Classes not Listed in ClassWizard. Seems to be the answer. I still dont understand WHY classwizard doesnt support though-
|
|
|
|
|
I was playing around with dlls and made exported function like:
extern "C" {void __declspec(dllexport) __cdecl GetData(CString &szData);};
I loaded *function with GetProcAddress() and passed CString object to it. Then dll filled some text into it and i expected to get that data out of dll and actually i did, but when destructor of that CString was called i get error when m_psztext is deleted as it would be allready deleted before.
What did i do wrong?
|
|
|
|
|
Hi,
Dont use CString, use LPTSTR,
MFC uses some state information on a per-module
basis, and is very sensitive to module and
thread switches,
BTW did u include the AFX_MANAGE_STATE in
the exported function. ?
|
|
|
|
|
You can pass CStrings around if and only if you're using the same heap in .exe and .dll. Go to the project settings, then selectd 'C++' tab and 'Code Generation' category. You should ensure that both .exe and .dll use .dll runtime library.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
helo!
i am going to write an statefulll packet filtering firewall , can i block packet at very low level to stop DOS (Dannial Of services) attack on my server, is winsock support this feature, if winsock does not allow this feature then can i write a driver using DDK for doing this thing , kindly guide me for doing this thing .
a bundel of thanx
|
|
|
|
|
I have a document/view app which has drag/drop support to open files.
Currently the OnDropFiles() method calls the document's OnOpenDocument(), but this seems to have a few side effects
1) The document's title doesn't get updated
2) The view's OnInitialUpdate() doesn't get called, meaning my view doesn't realise the document has changed
What am I doing wrong?
Thanks,
Richard
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
You might consider calling
InitialUpdateFrame(pFrame, pDocument, bMakeVisible);
which will actually refresh the view and update the title.
Hope it works.
|
|
|
|
|
Hi
In my dialog I have two Date/Time-Picker-controls...one to select a date and another to select a time. I also have two variables, named
CDateTimeCtrl m_ctlTime;
CDateTimeCtrl m_ctlDate;
What's the easiest way to read their values (date and time) into one single CTime variable?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Use the overloaded construter
CTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST = -1 );
|
|
|
|
|
Try this...
SYSTEMTIME st;
m_ctlDate.GetTime(&st);
m_ctlTime.GetTime(&st);
CTime time = st;
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Using this approach the second call to 'GetTime' refill the time value
effectively erasing the previous value obtained from m_ctlDate.
|
|
|
|
|
Sorry - previous message contains invalid answer. This should work OK:
SYSTEMTIME stDate, stTime;
m_ctlDate.GetTime(&stDate);
m_ctlTime.GetTime(&stTime);
stDate.wHour = stTime.wHour;
stDate.wMinute = stTime.wMinute;
stDate.wSecond = stTime.wSecond;
CTime time = stDate;
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks guys!
What about using Prem's approach?
Instead of CDateTimeCtrl I made the varables CTime with names m_timeTime and m_timeDate
Thus I used this code:
UpdateData();
CTime Time(m_timeDate.GetYear(), m_timeDate.GetMonth(), m_timeDate.GetDay(), m_timeTime.GetHour(), m_timeTime.GetMinute(), m_timeTime.GetSecond());
Seems to be quite easy as well
modified 12-Sep-18 21:01pm.
|
|
|
|
|
For large no. of clients connect to server during the load test,getting the connection refused error,even if at server side the backlog in listen() method of the socket is put to maximum SOMAXCONN and creating the user thread for each user after accept.
How to solve this prob.
|
|
|
|
|
How many do you want it to keep in a backlog? Using SOMAXCONN justs tells the service provider to pick a reasonable value. This value could differ between service providers.
So basically, you can't flood your server with connection questions and expect them all to be placed on the backlog. That would actually be a bad design since you could in theory DOS the server by exhausting its memory with a huge backlog of connection requests.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
You gain nothing by calling listen each time after accept ing. The standard sequence is: listen once and then loop around accept .
Is you're having connections refused, try to speed up your accept -associated code. Your maximum rate of clients served per second is 1/t, where t is the time it takes to your app to accept a client. No backlog will improve that appart from providing some resiliance against temporary rushes. In Winsock 1.1 the maximum backlog is 5 (admittedly a little low), if you're using Winsock 2 you can set a more comfortable backlog size (though the value of SOMAXCONN for Winsock 2 is an overkill (0x7FFFFFFF), and you're better off setting something smaller than that.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How I can copy system registry files in win 2k? (winnt\system32\config\*.*) IMHO... it's posible only under DOS... What is your opinion? Sanks...
|
|
|
|
|
I was wondering how to create an SDI app thats view is one of a Shockwave Flash movie viewer. For example the flash viewer/projector app. I know that you can include it as an ActiveX control in a dialog but how would it work for a doc/view app.
Any examples/tutorials would be greatly appreciated.
.NET or not .NET? MFC is the question......
|
|
|
|
|
You could use a CHtmlView and make it load the .swf file
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
Does anyone know if there is a way to return the files from the functions FindFirstFile and FindNextFile sorted by name !?
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
|
|
|
|
|
AFAIK, it's not possible. You'll have to sort yourself - just store the names in std::vector and call std::sort.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|