|
I have a named pipe server, created using CreateNamedPipe(). Has anyone any idea how can I make it disallow remote clients (so only pipe clients on the same system as the server are allowed to connect to it) ?
Many thanks for any help.
Thanks,
Neil Humphreys.
|
|
|
|
|
I have an MFC application in which I need to perform a join operation of two tables Emp and Assets, with the EmpID field being the primary key. I did not use any AppWizard options to implement database connectivity functionality. Instead, I added two classes derived from CRecordset and two forms derived from CRecordview class to implement DBMS. I need to select all asets for a given EmpID in the Emp table and show the on a form. Is there a way to do this without using the m_strFilter variable/parameter stuff?
log live the dEvIL
|
|
|
|
|
I think you need to derive a class from CRecordset that has as its member variables all columns returned from the query. For example. given the following two tables:
Table1
=======
CustID
Name
Address
Phone
Table2
=======
OrderID
CustID
Total
the CRecordset -derived class would have a query that looked like:
SELECT Table1.Name, Table1.Address, Table1.Phone, Table2.Total
FROM Table1 INNER JOIN Table2 ON Table1.CustID = Table2.CustID
The class would need four member variables. Does this get you close?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Na, I am way too far. I did derive a class from CREcordset and linked it up to a table, I just need to set the filter. How do I do that?
long live the dEvIL
|
|
|
|
|
If you already have a CRecordset -derived class, and the subject of this thread indicates you want to implement a join, why not just change the value returned from the GetDefaultSQL() method? Using the m_strFilter member variable does not do the same thing as a join operation.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello
Can anybody explain to me why the following four bold lines of code yield different results to their counterparts on the line below? By my reckoning the results should be the same with the only difference being one set are printed to the console window and the other to a text file. The purple lines are definitely creating correct results because they are a product of help code for Microsoft Visual Studio .NET and the results look good. The red lines of code (my code) are definitely producing incorrect results and all four of the outputs are often identical. Am I doing some memory management incorrectly???
#include "stdafx.h"
#using
#include
#include
#include
using namespace System;
// This is the entry point for this application
int _tmain(void)
{
_int64 ctr1 = 0, ctr2 = 0, freq = 0;
int acc = 0, i = 0;
FILE *storage;
//Start timing the code
if(QueryPerformanceCounter((LARGE_INTEGER *)&ctr1) != 0)
{
storage = fopen("C:\\TestTimer.txt", "a"); //Open a file for data output
//Code segment is being timed
for(i=0; i<100; i++) acc++;
//Finish timing the code
QueryPerformanceCounter((LARGE_INTEGER *)&ctr2);
fprintf(storage, "Start Value %s\n", ctr1.ToString());Console::WriteLine("Start Value: {0}",ctr1.ToString());
fprintf(storage, "End Value %s\n", ctr2.ToString());
Console::WriteLine("End Value: {0}",ctr2.ToString());
QueryPerformanceFrequency((LARGE_INTEGER *)&freq);
fprintf(storage, "Frequency %s\n", freq.ToString());Console::WriteLine(S"QueryPerformanceCounter minimum resolution: 1/{0} seconds.",freq.ToString());
fprintf(storage, "Time %s\n", ((ctr2-ctr1) * 1.0 / freq).ToString()); Console::WriteLine("100 Increment time: {0} seconds.",((ctr2-ctr1) * 1.0 / freq).ToString());
fclose(storage);
}
return 0;
}
|
|
|
|
|
You're mixing CLR strings with C-style strings. fprintf() expects a const char* on the stack, to be inserted where the %s is, however what you're putting on the stack is a whole System::String object, which is totally not the same thing. You need to convert that object to a C-style string (with PtrToStringChars , for example).
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
hello,
i'd like to have a progress control in each MDI document's frame, which holds a CScrollView. in particular, i'm interested in shortening the horizontal scrollbar in a CScrollView, and placing controls to the left of the scrollbar, something like the output view in MSVC 6, or like excel. i searched the articles for something like this, but couldn't find anything. does anyone have any suggestions regarding how to do this?
a simple (but, in my opinion, ugly) solution is to leave CScrollView alone, add a status bar to my CMDIChildWnd-derived frame class, and place the progress control in the status bar.
thanks,
ed
Edward H Herskovits
Noetic Systems Incorporated
www.noeticsystems.com
"When certainty is not enough."
|
|
|
|
|
You'll need to stop using the scrollbar that is part of the MDI Child window and use scrollbar controls instead. If you use MFC splitters in your MDI app then it will use scrollbar controls. You might want to have a look at that.
That said it seems strange to me to have porgress controls on the MDI windows. What is taking so long that you need a scroll bar at all, I have to wonder.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
i've developed a user interface to some number-crunching code; the user may want to analyze several documents at once without the GUI freezing, so i converted the analysis code to run in separate worker threads. i wanted to indicate progress for each document separately, rather than in the main frame's status bar, so i thought about having a progress control associated with each document/MDIChildWnd.
thanks for the advice.
ed
Edward H Herskovits
Noetic Systems Incorporated
www.noeticsystems.com
"When certainty is not enough."
|
|
|
|
|
ehh wrote:
i've developed a user interface to some number-crunching code; the user may want to analyze several documents at once without the GUI freezing, so i converted the analysis code to run in separate worker threads. i wanted to indicate progress for each document separately, rather than in the main frame's status bar, so i thought about having a progress control associated with each document/MDIChildWnd.
Ok that makes sense now. Look at the MFC CSplitterWnd code and how it uses CScrollBar. It might be easier to switch to using CSplitterWnd the you'll get the scrollbar's you need. I don't know what would be involved in reducing there size though.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
what about adding a progress control below the view in the MDIChildWnd frame? has that been done?
thanks for your advice; i'll check out CSplitterWnd....
ed
Edward H Herskovits
Noetic Systems Incorporated
www.noeticsystems.com
"When certainty is not enough."
|
|
|
|
|
ehh wrote:
what about adding a progress control below the view in the MDIChildWnd frame? has that been done?
thanks for your advice; i'll check out CSplitterWnd....
I think it would be quite difficult to do as the View window is closely bound to the MDI window. But with enough time anything is possible.
Just did a quick Google search for "CScrollbar MDI" and found:
http://www.codeproject.com/splitter/ruler.asp[^] which may be of interest.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
PS. It might be easier to create a child window that sits in a corner of the mdi window and show the progress ctrl there.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Actualy it is not that simple ... because i'm trying to learn and i don't have "Help" nor "MSDN" nor friends that know Visual C++ ...
My problem is with a Check_box .. i'm used to using Delphi ... in this case i don't have Delphi .. i must use Visual Studio C++ ... So I've banged my head in this small problem ...
I whant something like this ... when I click the Check_Box, a Edit_Box that was disabled, to be enabled ... this is what i've come up with :
<b> <code>int checkState;
CButton* pCheck = (CButton*)GetDlgItem(Check_Eagle);
if (pCheck->GetCheck() == 0) {
pCheck->SetCheck(1);}
else pCheck->SetCheck(0);
</code> </b>
When i hit a Button i whant to do the check ... if GetCheck = 1 then Edit_Eagle = Enabled ... and to enter a value in the same time ... :->:-> ...
can anyone help ?
iarta, iubeste, zimbese, exprima-te, relaxeaza-te, ajuta un batrin, accepta un compliment, ascula-ti prieteii, reia un proiect abandonat, fii intelegator cu tine si cu altii, uita-te la un album cu fotografii, picteaza un tablou, asculta tacerea, aminteste-ti intotdeauna ca nu esti singur, spune-le celor ragi cit de mult ii iubesti, imagineaza-ti ca astazi nu ai nici o grija, joaca-te cu un copil, citeste o carte buna, alege-ti o stea de pe cer, fii copil inca o data, suna-ti prietenii cu care n-ai vorbit de mult, da-ti voie sa mai si gresesti, lasai pe altii sa te ajute, renunta la ce u iti place, indeplineste-ti promisiunile, inchide ochii si imagineaza-ti ca esti pe o plaja tropicala, priveste atent o floare, cumpara-ti ceva ce iti doresti de mult, spera ca ceea ce iti doresti se va indeplini, ajuta-i pe altii, respira profund, fa-ti un cadou, iubeste !!!
|
|
|
|
|
assasin_shark wrote:
i don't have "Help" nor "MSDN"...
Actually you do. Check out http://msdn.microsoft.com[^].
When calling GetCheck() and SetCheck() , use BST_UNCHECKED and BST_CHECKED instead of 0 and 1. It has nothing to do with your problem, but it does make the code more readable.
assasin_shark wrote:
CButton* pCheck = (CButton*)GetDlgItem(Check_Eagle);
The value passed to GetDlgItem() should be the ID of the checkbox control. Is that what Check_Eagle is, or is it a (int ) variable?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
<small><b>DavidCrow wrote:</b></small>
<i>Actually you do. Check out http://msdn.microsoft.com.</i>
Actualy i was there .. but .. realy .. i didn't find what i was locking for ...
<small><b>DavidCrow wrote:</b></small>
<i>When calling GetCheck() and SetCheck(), use BST_UNCHECKED and BST_CHECKED instead of 0 and 1.</i>
u mean <code>SetCheck(BST_CHECKED)</code> ?
<small><b>DavidCrow wrote:</b></small>
<i>Is that what Check_Eagle is, or is it a (int) variable? </i>
<code>Check_Eagle</code> is the name or ID of the Check_box, yes ...
iarta, iubeste, zimbese, exprima-te, relaxeaza-te, ajuta un batrin, accepta un compliment, ascula-ti prieteii, reia un proiect abandonat, fii intelegator cu tine si cu altii, uita-te la un album cu fotografii, picteaza un tablou, asculta tacerea, aminteste-ti intotdeauna ca nu esti singur, spune-le celor ragi cit de mult ii iubesti, imagineaza-ti ca astazi nu ai nici o grija, joaca-te cu un copil, citeste o carte buna, alege-ti o stea de pe cer, fii copil inca o data, suna-ti prietenii cu care n-ai vorbit de mult, da-ti voie sa mai si gresesti, lasai pe altii sa te ajute, renunta la ce u iti place, indeplineste-ti promisiunile, inchide ochii si imagineaza-ti ca esti pe o plaja tropicala, priveste atent o floare, cumpara-ti ceva ce iti doresti de mult, spera ca ceea ce iti doresti se va indeplini, ajuta-i pe altii, respira profund, fa-ti un cadou, iubeste !!!
|
|
|
|
|
assasin_shark wrote:
i didn't find what i was locking for ...
Specify exactly what you are looking for and someone will point you in the right direction.
assasin_shark wrote:
u mean SetCheck(BST_CHECKED) ?
Exactly.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
ok .. that solves one of the problems ... but the most impotant one ???
how do i do that ???
|
|
|
|
|
assasin_shark wrote:
how do i do that ???
How do you do what? You've not specified what the problem is. The code snippet in your original post appears to be syntactically correct. What part of it is in error?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
not eror ... just that i don't know how to do that ... i'll tell u again ... i whant to make an Edit_Box "Enabled" after i click the Check_Box and to enter a value also .. in te same time ... my problem is with the changing of the status of the Edit_box because of my click ... understand ?
nu prea ma fac inteles, dar incerc sa ma exprim !!!
|
|
|
|
|
Assuming your dialog class has a CEdit member variable mapped to the edit control, you can use:
m_ebEdit.Enabled(pCheck->GetCheck() == BST_CHECKED);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Actually what David meant was:
m_ebEdit.<code>EnableWindow</code> (pCheck->GetCheck() == BST_CHECKED); /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hummm, most of MSDN is on line (avialable via www). If you're developing the program using the VC++ IDE, then you should already have access to MSDN; otherwise there would be no help avialable when you hit F1. If you are using MFC (via VC++), then activating the class wizard will give you the option of setting the UI options (via command id) as follows:
void MyView::OnUpdateColortypeFill(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_Grid.GetColorType() == CGetColor::FILL);
}
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
guys .. i apreciate the help .. but it would be better if u would tell me were to put the sequence of code ... these are my arrors ....
<br />
D:\DOCUMENTELE MELE\3\3Dlg.cpp(150) : error C2653: 'MyView' : is not a class or namespace name<br />
D:\DOCUMENTELE MELE\3\3Dlg.cpp(152) : error C2065: 'm_Grid' : undeclared identifier<br />
D:\DOCUMENTELE MELE\3\3Dlg.cpp(152) : error C2228: left of '.GetColorType' must have class/struct/union type<br />
D:\DOCUMENTELE MELE\3\3Dlg.cpp(152) : error C2653: 'CGetColor' : is not a class or namespace name<br />
D:\DOCUMENTELE MELE\3\3Dlg.cpp(152) : error C2065: 'FILL' : undeclared identifier<br />
D:\DOCUMENTELE MELE\3\3Dlg.cpp(164) : error C2065: 'm_ebEdit' : undeclared identifier<br />
D:\DOCUMENTELE MELE\3\3Dlg.cpp(164) : error C2228: left of '.EnableWindow' must have class/struct/union type<br />
so .. i'm in the fog again ..
|
|
|
|
|