|
RChin, I've done everythink, but now it does not work again.
Please, if you can, look at my code. You can download my program from
http://bilasguitar.narod.ru/confidential/tempo.zip - 54Kb.
A problem is in MyDialog.cpp
Thanks in advance,
bilas.
|
|
|
|
|
bilas, I've had a quick look at your code and although there are quite a
few issues with the code, I will try to only comment on the revelant ones.
You have a JET database with the following dataset:
<small>
Sys_Cd Sys_Nm Sys_ParRcd Sys_Rcd
-------+-----------+------------+---------
25 | record15 | 3 | 8
30 | Parent 2 | 0 | 9
31 | Child 1 | 9 | 10
32 | Child 2 | 9 | 11
33 | Child 3 | 9 | 12
10 | Parent 0 | 0 | 1
11 | record01 | 1 | 2
20 | Parent 1 | 0 | 3
21 | record11 | 3 | 4
22 | record12 | 3 | 5
23 | record13 | 3 | 6
24 | record14 | 3 | 7
</small>
.First off, this is the order that you will get when you open up the recordset
in openTable mode. If you require a different order (which I suspect you do), you will have to
either:
1. Open the recordset in openQuery mode, using an SQL statement to order your
result set. ("SELECT * FROM [main] ORDER BY [sys_Rcd]")
2. If you need to open up the table directly, you will have to ensure that the indices of the
field that you want returned in a specific order exist. Currently you have three indices defined, in addition
to the primary key.
I suspect that you wanted your tree to be ordered by the Sys_Rcd field, with the Sys_ParRcd
field determining whether the item is a parent or a child, so whould look a bit like this:
<small>
+---Parent 0
| \---record01
+---Parent 1
| +---record11
| +---record12
| +---record13
| +---record14
| \---record15
+---Parent 2
+---Child 1
+---Child 2
\---Child 3
</small>
Secondly, the problem you seem to be having is not a database
connectivity issue, but a tree population one. The ADO class acts just as it should,
you just need to know what its doing so that you can populate your tree accordingly.
The population code seems a bit messy and at times confusing. Separate this out into a separate
function and work through what you want to achieve logically. Possibly write down first on a
sheet of paper in psuedo-programming exactly what you want to be done before creating your function.
Thirdly. There one or two potentially serious coding errors that
may trouble you later on. For Example:
if(val1 == '0') , should be changed to
if(strcmp(val1,_T("0")) == 0) or if(val1.Compare("0")==0)
Infact, since the field is already a number, you can retrieve this to an integer variable.
Also, your CMyDialog is being allocated on the heap via the View class without being
deleted, so you will see memory leaks when the application exits.
Anyway, I hope these comments helps in your quest for programming peace and fulfilment
I Dream of Absolute Zero
|
|
|
|
|
RChin, I really thank you for your explanation. It is very important for me to have information you
wrote. Can't express my gratitude for your usefull efforts.
Only one question: how can I know the order of records(like you wrote above) when I open my
database?
Bilas.
|
|
|
|
|
I have slider control control with 4 ticks,
but if I ask position of index=2 tick
slider return error value - incorrect index:
<br />
int tic_min, tic_max;<br />
<br />
pForm->m_SliderPage.GetRange (tic_min, tic_max);<br />
<br />
int x= pForm->m_SliderPage.GetTicPos(poz);<br />
<br />
<br />
<br />
why so happens?
thanks
|
|
|
|
|
Have you tested other positions ? 0, 1, 3 ?
Do they return correct values ?
Your code only shows that your slider's range is from 0 to 3. It does not show whether you have set it to have ticks at 1 intervals. For this purpose, the style TBS_AUTOTICKS must be set when creating, after which a call to SetTicFreq member with parameter 1 would do the job.
Try calling GetTickPos with different values. If all return -1, you've forgotten something in the initialization of the control. If only position 2 returns -1, then check your tic frequency and/or force it to '1'.
Remember, that the range setting does not assume that there are ticks in the control. A slider control with a range 0 -> 3 without ticks would result in a bar which has 0 at the other end, 3 at the other, and nothing inbetween. This would cause a '-1' to be returned from a query for an invalid position. In this case, only positions 0 (0) and 1 (3) would be valid.
Here, I assume you use CSliderCtrl MFC class. If you use a custom slider control, then it's implementation might be buggy.
Try out those suggestions and reply with results. Then I might be able to help you more.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
0,1 postions are working.
If I make 10 positions
0-8 positions working, but not two last...
what problem witj two last positions can be?
thanks.
|
|
|
|
|
Add the style 'TBS_AUTOTICK' to the control's style flags.
Then call SetTickFreq(1) after setting the ranges. Now try again, it should work. At least I got my slider to work smoothly
The last option is to do the above, and a button to show the currently selected notch index. Then run the program, moving the slider and pressing the button at each notch to see it's index. If the "currently selected notch" query handles all notches correctly, then there's a bug in the implementation of the control. Getting an upgraded version of MFC might help.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Is there any possibility to call a function when an email arrives in the Outlook Express. How to get notification when an email arrives.
Please help
|
|
|
|
|
Could you specify a bit more of what you want to do ?
The Outlook Express will send a self-notification when a new e-mail message is available. This notification will cause a small task tray icon to pop up. We have all seen this.
You would need to do some hacking with Spy++ to find out what message it is that OE generates/sends when a new e-mail message is available. Then hook the OE's window procedure, and handle this message yourself before posting it forwards to OE or dumping it.
Remember that dumping the new message notification may cause the message not to be displayed on OE's message list.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Well, what I really want to do is a project which scans an incoming email content and puts it to a folder dependently what the content looks like.
Please give me any suggestions, maybe a piece of code.
Thank you
|
|
|
|
|
Get the Outlook Express ActiveX component. It is available freely for evaluation, and exposes the entire OE Interface for your use. Works much like Word/Excel/Outlook automation objects.
Of course there are alternative, and free, ways to accomplish all this, but it would be much more difficult. Use the ActiveX component, as it is available. Trust me, although the component does cost £19, it will make your work a whole lot easier. Especially if you're trying to build a spam filter or something similar...
Here's a link to the component creator's website: Small Office Solutions Ltd.[^]
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Well, I would rather write it in C++ without using any components(especially in case the component is written in VB). How to check in spy++ what kind of message is comming when an email arrives?
I know there are some products which have control on Outlook, without using any components, so I want to achive the same.
Any more sugestions?
P.S Thank ypu for your help
|
|
|
|
|
Another question. Can I use MAPI to solve the problem?
|
|
|
|
|
Outlook Express does not get notified if there are new messages in the POP3 mailbox (it is Outlook which does get notications), OE rather checks itself the contents of the POP3 mailbox after a user defined time intervall has elapsed.
That means you can programmatically do the same from your own prog, independently of Outlook Express. You can also use for this ready made POP3 classes like
http://www.codeproject.com/internet/win32_pop3.asp
Then analyze the messages in the POP3 mailbox, and also let OE download them.
The data (like user, server name etc.) of the predefined POP3 mailboxes of OE you can find find under HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts
The full path to the message files (like incoming messages, sent messages etc. is under HKEY_CURRENT_USER\Identities\..Identity GUID..\Software\Microsoft\Outlook Express\...Version...\Store Root
Peter Molnar
|
|
|
|
|
Int the following code, I'm overriding CPropertySheet::RemovePage(int nPage)
How can I return a pointer to cdxCDynamicPropPage?
class cdxCDynamicPropSheet:public CPropertySheet {}
class cdxCDynamicPropPage :public CPropertyPage{}
void cdxCDynamicPropSheet::RemovePage( int nPage )
{
ASSERT_VALID(this);
// remove the page externally
if (m_hWnd != NULL)
SendMessage(PSM_REMOVEPAGE, nPage);
cdxCDynamicPropPage* page = ???
page->m_pSheet = NULL;
}
|
|
|
|
|
Use CPropertySheet::GetPage before sending the message to get a pointer to the CPropertyPage . Then use DYNAMIC_DOWNCAST to cast a pointer to your derived cdxDynamicPropPage class.
cdxCDynamicPropPage* pPage = DYNAMIC_DOWNCAST(cdxCDynamicPropPage, this->GetPage(nPage) );<DIV>
SendMessage(PSM_REMOVEPAGE, nPage); Something like that. Remember, though, that a better way would be to call CPropertySheet::RemovePage instead of sending a message. This way, the property page window will be deleted, but the page object would remain, leaving the pointer returned by GetPage valid.
Here is a different implementation of your RemovePage method, which removes a page from a property sheet, and then fiddles with the page object.
void cdxCDynamicPropSheet::RemovePage(int nPage)
{
ASSERT_VALID(this);<DIV>
this->CPropertySheet::RemovePage(nPage);<DIV>
cdxCDynamicPropPage* pRemovedPage = DYNAMIC_DOWNCAST( cdxCDynamicPropPage, this->GetPage(nPage) );<DIV>
ASSERT( pRemovedPage != NULL );<DIV>
pRemovedPage->SomeMethod( someParams );
} Hope this helps.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
It helped Thanks a lot
|
|
|
|
|
BOOL LookupAccountName(
LPCTSTR lpSystemName, // address of string for system name
LPCTSTR lpAccountName, // address of string for account name
PSID Sid, // address of security identifier
LPDWORD cbSid, // address of size of security identifier
LPTSTR ReferencedDomainName,
// address of string for referenced domain
LPDWORD cbReferencedDomainName,
// address of size of domain string
PSID_NAME_USE peUse // address of SID-type indicator
);
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
|
Thank you Michael
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Hi,
I've posted a meesage like this about a month ago on this forum, but I didn't get any satisfacting responses; so I'll try again.
I've created a setup prject, with the "Setup Projects" template, this is for an MFC C++ application. The installer works great, but I want to let the user determine wether he wants a shortcut placedn on his desktop\start menu. So I added a new dialog to my project, containing three checBoxes.
But after having done this, I wanted to a some kind of 'link' between checking a checkbox and the creation of a shortcut. If already inserted the shortcuts in the FileSystem tab, but I don't know how to script the decision correctly (I know C and its derivates, not Basic!). I've already looked at the MSDN, but I can't find a nice answer!
The properties of the checkbox are these: (in the user interface editor!) (I haven't included irrelevant properties (irrelevant to me))
CheckBox1Property : CHECKBOXC1
CheckBox1Value : Unchecked
|
|
|
|
|
Hi
You do not have to script anything to do this.
What You do is, create the shortut in the installation project as normal, and in the "Condition" property of the sourtcut write "CHECKBOXC1 = checked".
That's it.
|
|
|
|
|
Thanks, I'll try it
I didn't know it was that simple!
|
|
|
|
|
I jsut tried your solution, but it isn't working, although I entered the text (without the double quotation amrks in the conditions field). I tried it with a capitalized c in checked, and put transitive on true and false.
No combination of it seemed to worrk --> the shortcut was created every time I tried the installer (it should only be created if the checkbox is checked).
|
|
|
|
|
|