Default Directory in Rogue Wave - c++

I am trying to get IlvFileChooser to open in a default directory but can't find any option to do that. Any ideas please?
IlvFileChooserOptions* opt = new IlvFileChooserOptions(IlvFileChooserOpen);
opt->addFilter("Comma separated files (*.csv)", "csv");
IlvFileChooser* dlg = new IlvFileChooser(SIDGetDisplay(), 0, 0, opt);
if (dlg->get() > 0)
{
...
}

From the rogue-wave documentation, it seems like the second argument to IlvFileChooser is the default directory.
The documentation is you want is here.

Related

Edge First Tab Error when Opening via System()

When doing
const std::string LaunchStr = "C:\\\"Program Files (x86)\"\\Microsoft\\Edge\\Application\\msedge.exe --profile-directory=\"Profile 1\" C:\\Users\\redacted1\\redacted4.html";
System(LaunchStr.c_str());
Microsoft Edge launches as expected, the loaded profile is the correct one and there is a new tab on redacted4.html. However, the first tab (and the focused one too) is the following url program%20--fast-start%20files%20%28x86%29/Microsoft/Edge/Application/msedge.exe. Which I find weird because nowhere in my code do I write program%20--fast-start%20files%20%28x86%29/.
Why is that? How can I prevent it?
I suggest you try to refer to the sample code below that may help you to launch the MS Edge browser correctly with the correct profile and with the specified URL.
#include <windows.h>
int main()
{
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
SHELLEXECUTEINFOW sei = { sizeof sei };
sei.lpVerb = L"open";
sei.lpFile = L"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
sei.lpParameters = L"--user-data-dir=\"C:\\Users\\<user>\\AppData\\Local\\Microsoft\\Edge\\User Data\\Profile 1\" C:\\Users\\redacted1\\redacted4.html"; // Modify the path for user-profile here...
ShellExecuteExW(&sei);
}
Note: You can type edge://version/ in the address bar of the Edge browser and see the profile path to modify it in the above code sample.
Output:

'operator=' is deprecated: Use QDir::setPath() instead

Simple program that opens a GUI, you click one button to set curDir, click another button to set savDir, and a third button does some C++ code similar to
ls -l curDir > savDir.txt
One of my Qt functions:
void dirList::on_savBut_clicked(){
savDir = QFileDialog::getExistingDirectory(
this,"Save Location",QDir::homePath());
savPath = savDir.absolutePath();
ui->savText->setText(savPath);
}
On the savDir = QFileDialog::getExistingDirectory(... line I get a warning:
'operator=' is depreciated: Use QDir::setPath() instead
Could anyone give an example how I might incorporate setPath()?
You can simply write
savPath = QFileDialog::getExistingDirectory(
this,"Save Location",QDir::homePath());
Without using savDir.
I believe setPath is just a drop in replacement instead of using assignment for when updating a QDir with a QString path.
savDir = QFileDialog::getExistingDirectory(
this,"Save Location",QDir::homePath());
simply becomes
savDir.setPath(QFileDialog::getExistingDirectory(
this,"Save Location",QDir::homePath()));

PowerBI: Check if the folder/directory we are loading to exists or not using Power Query

I am a newbie in PowerBi and currently working on a POC where I need to load data from a folder or directory. Before this load, I need to check if
1) the respective folder exists
2) the file under the folder is with.csv extension.
Ex. Let suppose we have a file '/MyDoc2004/myAction.csv'.
Here first we need to check if MyDoc2004 exists and then if myAction file is with.csv extension.
Is there any way we can do this using Power Query?
1. Check if the folder exists
You can apply Folder.Contents function with the absolute path of the folder, and handle the error returned when the folder does not exist with try ... otherwise ... syntax.
let
absoluteFolderPath = "C:/folder/that/may/not/exist",
folderContentsOrError = Folder.Contents(absoluteFolderPath),
alternativeResult = """" & absoluteFolderPath & """ is not a valid folder path",
result = try folderContentsOrError otherwise alternativeResult
in
result
2. Check if the file is with .csv extension
I'm not sure what output you are expecting.
Here is a way to get the content of the file by full path including ".csv", or return an alternative result if not found.
let
absoluteFilePath = "C:/the/path/myAction.csv",
fileContentsOrError = File.Contents(absoluteFilePath),
alternativeResult = """" & absoluteFilePath & """ is not a valid file path",
result = try fileContentsOrError otherwise alternativeResult
in
result
If this is not what you are looking for, please update the question with the expected output.
Hope it helps.

Aspose Wordsfor .NET: replace link contents keeping (setting) it's style

There is much info over internet telling how to change link contents with Aspose Wordsfor .NET. Also, there is enough info about setting link style after insertion.
But I have a problem: I need to modify existed link (from template) keeping (or just setting) it's visual style (underlined blue text). By defaul, after link change (se code below) it's style is broken.
foreach (Field field in docTemplate.Range.Fields)
{
if (field.Type == FieldType.FieldHyperlink)
{
var hyperlink = (FieldHyperlink)field;
if (hyperlink.Result.Equals("<<[model.Id]>>"))
{
hyperlink.Address = model.IdUrl;
hyperlink.Result = model.Id;
}
}
}
Does any solution for this case exist? Will appreciate any help.
I have tested your scenario with Aspose.Words for .NET 17.4 and unable to notice hyperlink style issue, it remains intact after modification. If you are using some old version of Aspose.Words for .NET then please upgrade to latest version, hopefully it will resolve the issue.
However, if your issue persists then please share your complete code along with your input,output and expected documents. It will help to understand your issue exactly.
I'm Tilal, developer evangelist at Aspose.
Document doc = new Document("Hyperlink.docx");
//You may change the color of Hyperlink style, if required.
//doc.Styles[StyleIdentifier.Hyperlink].Font.Color = Color.Blue;
//doc.Styles[StyleIdentifier.FollowedHyperlink].Font.Color = Color.Blue;
foreach (Field field in doc.Range.Fields){
if (field.Type == FieldType.FieldHyperlink){
FieldHyperlink link = (FieldHyperlink) field;
if (link.Result.Equals("aspose.com"))
{
link.Result = "google";
link.Target = "www.google.com";
}
}
}
doc.Save("Hyperlink_174.docx");
Edit: If you want to modify a specific hyperlink then use following code snippet.
Document doc = new Document("E:/Data/Hyperlink.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
foreach (Field field in doc.Range.Fields)
{
if (field.Type == FieldType.FieldHyperlink)
{
FieldHyperlink link = (FieldHyperlink)field;
if (link.Result.Equals("aspose.com"))
{
builder.MoveToField(link, false);
builder.Font.ClearFormatting();
// Specify font formatting for the hyperlink.
builder.Font.Color = Color.Blue;
builder.Font.Underline = Underline.Single;
// Insert the link.
builder.InsertHyperlink("google", "http://www.google.com", false);
link.Remove();
}
}
}
doc.Save("UpdatedHyperlink.docx");

Minifilter redirect file creation in pre operation?

I am trying to redirect file creation on a volume of hard disk (i.e \Device\HarddiskVolume2)
I found redirecting file name in minifilter open pre. But I got a system dialog as below
Here is my code:
// I tested with pFileName = &Data->Iopb->TargetFileObject->FileName;
// It has same result
pFileName = &FltObjects->FileObject->FileName;
if (pFileName->Buffer != NULL)
ExFreePool(pFileName->Buffer);
// gRedirectFullFilePath is \\Device\\HarddiskVolume2\\File.ext
pFileName->Length = gRedirectFullFilePath.Length;
pFileName->MaximumLength = pFileName->Length;
pFileName->Buffer = (PWCH) ExAllocatePool(NonPagedPool, pFileName->MaximumLength);
if (pFileName->Buffer == NULL)
goto PreOperationCleanup;
RtlCopyUnicodeString(pFileName, &gRedirectFullFilePath);
// Change I/O status
Data->IoStatus.Information = IO_REPARSE;
Data->IoStatus.Status = STATUS_REPARSE;
Data->Iopb->TargetFileObject->RelatedFileObject = NULL;
FltSetCallbackDataDirty(Data);
return FLT_PREOP_COMPLETE;
I want this dialog to be not show. How should I do?
Thanks very much!
You should check SimRep File System Minifilter Driver example from WDK8.1 samples.
For example it ignores volume opens (FO_VOLUME_OPEN) and directory opens (SL_OPEN_TARGET_DIRECTORY). Maybe that is causing troubles to you.
It also uses IoReplaceFileObjectName to replace name of a file object (should be safer than direct changing of FILE_OBJECT).